# sayansr26/epub_viewer_new architecture

> Architecture diagram of the GitHub repository sayansr26/epub_viewer_new, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sayansr26/epub_viewer_new
- Repository: https://github.com/sayansr26/epub_viewer_new

## Overview

##### Main Components Identification

The system should be represented as a Flutter Plugin Architecture with the following key components:

a) Flutter Layer (Dart)
- Main Plugin Interface
- Model Layer
- Utility Layer

b) Platform-Specific Implementations
- iOS Implementation (Swift/Objective-C)
- Android Implementation (Java)
- Desktop Support Layer (Windows/Linux/MacOS)

c) External Framework
- FolioReader Integration

**Level 1 (Top): Flutter Application Integration Point**
**Level 2: Core Plugin Interface (epub_viewer_new.dart)**
**Level 3: Platform Channels and Implementation**
**Level 4: Platform-Specific Readers**

##### Component Relationships

a) Main Flow:
- Flutter App → epub_viewer_new.dart (Plugin Interface)
- Plugin Interface → Platform Channel
- Platform Channel → Native Implementations
- Native Implementations → FolioReader Framework

b) Supporting Flows:
- Model Layer ↔ Plugin Interface
- Utility Layer ↔ Plugin Interface

- EpubViewerPlugin (Main Interface)
- EpubLocator Model
- Platform-Specific Readers
- Configuration Handlers

- Reading Time Tracking
- Location Management
- Asset Loading
- Distraction-Free Mode (Android-only)

##### Implementation Details to Highlight

- Method Channel Communication
- Platform-Specific Configurations
- Data Model Serialization
- Feature Availability per Platform

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Flutter_App
        FA[Flutter Application]
    end

    subgraph Plugin_Interface
        PI["Main Plugin Interface"]:::dart
        ML["Model Layer"]:::dart
        UL["Utility Layer"]:::dart
        SD["Scroll Direction Enum"]:::dart
        EL["EpubLocator Model"]:::dart
    end

    subgraph Platform_Channel
        MC["Method Channel"]
    end

    subgraph Android_Implementation
        AP["Android Plugin"]:::android
        AR["Android Reader"]:::android
        AC["Android Config"]:::android
        AF["FolioReader-Android"]:::external
    end

    subgraph iOS_Implementation
        IP["iOS Plugin"]:::ios
        IS["iOS Swift Implementation"]:::ios
        IC["iOS Config"]:::ios
        IF["FolioReader-iOS"]:::external
    end

    subgraph Desktop_Support
        DL["Linux Support"]:::desktop
        DW["Windows Support"]:::desktop
        DM["MacOS Support"]:::desktop
    end

    %% Connections
    FA --> PI
    PI --> MC
    MC --> AP & IP & DL & DW & DM
    
    %% Model and Utility connections
    ML <--> PI
    UL <--> PI
    SD --> ML
    EL --> ML

    %% Platform Implementation connections
    AP --> AR
    AR --> AC
    AR --> AF

    IP --> IS
    IS --> IC
    IS --> IF

    %% Styling
    classDef dart fill:#2196F3,color:white
    classDef android fill:#4CAF50,color:white
    classDef ios fill:#FF9800,color:white
    classDef desktop fill:#9E9E9E,color:white
    classDef external fill:#9C27B0,color:white

    %% Click events
    click PI "https://github.com/sayansr26/epub_viewer_new/blob/master/lib/epub_viewer_new.dart"
    click ML "https://github.com/sayansr26/epub_viewer_new/tree/master/lib/model"
    click UL "https://github.com/sayansr26/epub_viewer_new/blob/master/lib/utils/util.dart"
    click EL "https://github.com/sayansr26/epub_viewer_new/blob/master/lib/model/epub_locator.dart"
    click SD "https://github.com/sayansr26/epub_viewer_new/blob/master/lib/model/enum/epub_scroll_direction.dart"
    click AP "https://github.com/sayansr26/epub_viewer_new/blob/master/android/src/main/java/com/webduniya/wpub_viewer_new/EpubViewerPlugin.java"
    click AR "https://github.com/sayansr26/epub_viewer_new/blob/master/android/src/main/java/com/webduniya/wpub_viewer_new/Reader.java"
    click AC "https://github.com/sayansr26/epub_viewer_new/blob/master/android/src/main/java/com/webduniya/wpub_viewer_new/ReaderConfig.java"
    click IP "https://github.com/sayansr26/epub_viewer_new/blob/master/ios/classes/EpubViewerPlugin.m"
    click IS "https://github.com/sayansr26/epub_viewer_new/blob/master/ios/classes/SwiftEpubKittyPlugin.swift"
    click IC "https://github.com/sayansr26/epub_viewer_new/blob/master/ios/classes/EpubConfig.swift"
    click DL "https://github.com/sayansr26/epub_viewer_new/blob/master/linux/flutter/generated_plugin_registrant.cc"
    click DW "https://github.com/sayansr26/epub_viewer_new/blob/master/windows/flutter/generated_plugin_registrant.cc"
    click DM "https://github.com/sayansr26/epub_viewer_new/blob/master/macos/Flutter/GeneratedPluginRegistrant.swift"
```
