# apliarte/flutter-toktik architecture

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

- Interactive diagram: https://gitdiagram.com/apliarte/flutter-toktik
- Repository: https://github.com/apliarte/flutter-toktik

## Overview

##### Project type and purpose
- This is a cross-platform Flutter app named “Toktik” for playing local vertical videos.
- There is no remote backend: videos live in the local file system (assets/videos or downloaded into storage).
- Architecture follows a layered, domain-driven approach with Presentation → Domain → Infrastructure.

##### File structure
- Top-level directories:
- android, ios, linux, macos, windows, web: platform-specific Flutter host code
- lib: the Flutter “core”
- assets: holds placeholder for downloaded videos
- test: widget tests
- Under lib:
- config: theming and helper utilities (human_formats, app_theme)
- domain/entities: pure data models (VideoPost)
- infrastructure/models: mapping between domain entities and raw data sources (LocalVideoModel)
- presentation:
– providers: state management classes (DiscoverProvider)
– screens: UI pages (DiscoverScreen)
– widgets: reusable UI (video player, scrollable views, buttons)
- shared/data: a hard-coded list of video metadata (local_video_posts.dart)
- No HTTP clients, no external services, but uses video_player plugin under the hood via Flutter engine.

##### Extract insights from README
- All videos are local and must be named 1.mp4…8.mp4 in assets/videos (or device storage).
- No cloud-based data source: purely local playback demo.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "lib/config"
        HumanFormats["HumanFormats"]:::config
        AppTheme["AppTheme"]:::config
        Pubspec["pubspec.yaml"]:::config
    end

    subgraph "lib/domain"
        VideoPost["VideoPost"]:::domain
    end

    subgraph "lib/infrastructure"
        LocalVideoModel["LocalVideoModel"]:::infra
    end

    subgraph "lib/shared/data"
        LocalVideoPosts["LocalVideoPosts"]:::infra
    end

    subgraph "lib/presentation"
        subgraph Providers
            DiscoverProvider["DiscoverProvider"]:::presentation
        end
        subgraph Screens
            DiscoverScreen["DiscoverScreen"]:::presentation
        end
        subgraph Widgets
            VideoScrollableView["VideoScrollableView"]:::presentation
            VideoButtons["VideoButtons"]:::presentation
            FullscreenPlayer["FullscreenPlayer"]:::presentation
            VideoBackground["VideoBackground"]:::presentation
        end
    end

    AssetBundle["Asset Bundle (assets/videos)"]:::asset
    Plugin["video_player plugin"]:::plugin
    NativeAPIs["Native Video APIs"]:::platform

    subgraph "Platform Hosts"
        Android["Android MainActivity"]:::platform
        iOS["iOS AppDelegate"]:::platform
        Linux["Linux main.cc"]:::platform
        macOS["macOS AppDelegate"]:::platform
        Windows["Windows main.cpp"]:::platform
        Web["Web index.html"]:::platform
    end

    DiscoverScreen -->|"subscribes"| DiscoverProvider
    DiscoverProvider -->|"fetchVideos()"| LocalVideoPosts
    DiscoverProvider -->|"mapData()"| LocalVideoModel
    LocalVideoPosts -->|"loadURIs()"| AssetBundle
    LocalVideoModel -->|"to VideoPost"| VideoPost
    VideoPost -->|"used by"| DiscoverProvider
    DiscoverProvider -->|"provides list"| DiscoverScreen
    DiscoverScreen -->|"renders"| VideoScrollableView
    VideoScrollableView -->|"uses"| VideoButtons
    VideoScrollableView -->|"uses"| VideoBackground
    VideoBackground -->|"onPlay() calls"| FullscreenPlayer
    FullscreenPlayer -->|"playVideo(uri)"| Plugin
    Plugin -->|"platform channel"| NativeAPIs

    Plugin --> Android
    Plugin --> iOS
    Plugin --> Linux
    Plugin --> macOS
    Plugin --> Windows
    DiscoverScreen -->|"HTML video tag"| Web

    Pubspec -->|"defines dependencies"| Plugin

    classDef presentation fill:#ADD8E6,stroke:#000;
    classDef domain fill:#90EE90,stroke:#000;
    classDef infra fill:#FFA500,stroke:#000;
    classDef config fill:#D3D3D3,stroke:#000;
    classDef asset fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5;
    classDef plugin fill:#9370DB,stroke:#000;
    classDef platform fill:#D3D3D3,stroke:#000;

    click DiscoverScreen "https://github.com/apliarte/flutter-toktik/blob/main/lib/presentation/screens/discover/discover_screen.dart"
    click VideoScrollableView "https://github.com/apliarte/flutter-toktik/blob/main/lib/presentation/widgets/shared/video_scrollable_view.dart"
    click VideoButtons "https://github.com/apliarte/flutter-toktik/blob/main/lib/presentation/widgets/shared/video_buttons.dart"
    click FullscreenPlayer "https://github.com/apliarte/flutter-toktik/blob/main/lib/presentation/widgets/video/fullscreen_player.dart"
    click VideoBackground "https://github.com/apliarte/flutter-toktik/blob/main/lib/presentation/widgets/video/video_background.dart"
    click DiscoverProvider "https://github.com/apliarte/flutter-toktik/blob/main/lib/presentation/providers/discover_provider.dart"
    click VideoPost "https://github.com/apliarte/flutter-toktik/blob/main/lib/domain/entities/video_post.dart"
    click LocalVideoModel "https://github.com/apliarte/flutter-toktik/blob/main/lib/infrastructure/models/local_video_model.dart"
    click LocalVideoPosts "https://github.com/apliarte/flutter-toktik/blob/main/lib/shared/data/local_video_posts.dart"
    click HumanFormats "https://github.com/apliarte/flutter-toktik/blob/main/lib/config/helpers/human_formats.dart"
    click AppTheme "https://github.com/apliarte/flutter-toktik/blob/main/lib/config/theme/app_theme.dart"
    click Pubspec "https://github.com/apliarte/flutter-toktik/blob/main/pubspec.yaml"
    click AssetBundle "https://github.com/apliarte/flutter-toktik/tree/main/assets/videos"
    click Android "https://github.com/apliarte/flutter-toktik/blob/main/android/app/src/main/kotlin/com/example/toktik/MainActivity.kt"
    click iOS "https://github.com/apliarte/flutter-toktik/blob/main/ios/Runner/AppDelegate.swift"
    click Linux "https://github.com/apliarte/flutter-toktik/blob/main/linux/main.cc"
    click macOS "https://github.com/apliarte/flutter-toktik/blob/main/macos/Runner/AppDelegate.swift"
    click Windows "https://github.com/apliarte/flutter-toktik/blob/main/windows/runner/main.cpp"
    click Web "https://github.com/apliarte/flutter-toktik/blob/main/web/index.html"
```
