# garlictot/bye-distract architecture

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

- Interactive diagram: https://gitdiagram.com/garlictot/bye-distract
- Repository: https://github.com/garlictot/bye-distract

## Overview

##### Project Type and Purpose
- This is a cross-platform Flutter application (“flutter_application_1”) targeting Android, iOS, Linux, macOS, Windows and Web.
- The “lib” folder contains your Dart UI, business logic and data-access code (config/api_config.dart, models, pages).
- No server-side code is present here; this is purely a client-side app that likely calls external REST APIs.

##### File Structure
- Top-level “android”, “ios”, “linux”, “macos”, “windows” and “web” folders are the platform‐specific embedder/runners generated by Flutter.
- The “lib” folder holds all the Dart code:
- lib/main.dart – entry point
- lib/config/api_config.dart – endpoint configuration
- lib/models – data model definitions (e.g., Task)
- lib/pages – UI screens (login, register, study rooms, todo list, statistics, etc.)
- “test” folder contains widget tests.
- pubspec.yaml declares Flutter and plugin dependencies.
- Platform folders contain build scripts (e.g., Gradle for Android, Xcode projects for iOS/macOS, CMake for Linux/Windows).

##### README
- This is the default Flutter template README; no additional architectural notes are provided.
- We must infer architecture from files: a standard Flutter layered client.

a. Main Components
1. UI Layer (Dart/UI)
– Pages: login_page, register_page, study_room_page, etc.
2. Business‐Logic / Controller Layer (could be your set of state managers or controllers invoked by pages)
3. Data Layer
– API Config (api_config.dart)
– HTTP Client (Dart’s http or Dio library)
– Models (task.dart, study room models, etc.)
4. Flutter Engine & Embedder
– Platform channels bridge your Dart code and native platform
5. Platform Runners
– Android (MainActivity.kt + Gradle)
– iOS (AppDelegate.swift + Xcode)
– Linux, macOS, Windows, Web (their respective runner code)
6. External Services
– REST API server(s)
– (Optionally) Local storage / SQLite / SharedPreferences if used

b. Relationships and Interactions
- User taps UI → UI Layer invokes Business Logic
- Business Logic calls Data Layer → constructs HTTP request using api_config → remote API
- Remote API responds with JSON → Data Layer parses into Model objects
- Business Logic notifies UI → UI updates widgets
- UI may also trigger local caching via plugins (if implemented)

c. Architectural Patterns / Principles
- Layered Architecture: UI → Logic → Data
- Platform Abstraction: Flutter Engine isolates Dart code from native embedding

d. Key Technologies / Frameworks
- Flutter SDK / Dart
- Platform SDKs: Android SDK, iOS CocoaTouch, Linux CMake, macOS Xcode, Windows CMake, Web (HTML/JS)
- Networking: Dart http package or similar
- State management (setState, Provider, Bloc, etc., if present)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        Pages["Pages"]:::ui
        Entry["Entry Point\nmain.dart"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        Logic["Business Logic\n(ViewModels/Controllers)"]:::logic
    end

    %% Data Layer
    subgraph "Data Layer"
        APIConfig["API Config"]:::data
        Models["Models"]:::data
        HTTPClient["HTTP Client"]:::data
    end

    %% Engine & Embedder
    Engine["Flutter Engine & Embedder"]:::engine

    %% Platform Runners
    subgraph "Platform Runners"
        Android["Android Runner\nMainActivity.kt"]:::platform
        iOS["iOS Runner\nAppDelegate.swift"]:::platform
        LinuxMain["Linux Runner\nmain.cc"]:::platform
        LinuxApp["Linux App\nmy_application.cc"]:::platform
        macOS["macOS Runner\nAppDelegate.swift"]:::platform
        Windows["Windows Runner\nmain.cpp"]:::platform
        Web["Web Entry\nindex.html"]:::platform
    end

    %% External Services & Others
    External["External REST API"]:::external
    Test["Widget Tests"]:::test
    Pubspec["pubspec.yaml"]:::manifest

    %% Connections
    Pages -->|invokes| Logic
    Entry -->|starts app| Engine
    Entry -->|initializes| Logic
    Logic -->|calls| HTTPClient
    HTTPClient -->|requests| External
    External -->|responds| HTTPClient
    HTTPClient -->|parses into| Models
    Models -->|provides data to| Logic
    APIConfig -->|configures endpoints for| HTTPClient
    Logic -->|updates| Pages
    Engine -->|runs on| Android
    Engine -->|runs on| iOS
    Engine -->|runs on| LinuxMain
    Engine -->|runs on| LinuxApp
    Engine -->|runs on| macOS
    Engine -->|runs on| Windows
    Engine -->|runs on| Web
    Test -->|tests UI| Pages
    Pubspec -->|declares deps for| Entry

    %% Click Events
    click Pages "https://github.com/garlictot/bye-distract/tree/master/lib/pages"
    click Entry "https://github.com/garlictot/bye-distract/blob/master/lib/main.dart"
    click APIConfig "https://github.com/garlictot/bye-distract/blob/master/lib/config/api_config.dart"
    click Models "https://github.com/garlictot/bye-distract/blob/master/lib/models/task.dart"
    click Android "https://github.com/garlictot/bye-distract/blob/master/android/app/src/main/kotlin/com/example/flutter_application_1/MainActivity.kt"
    click iOS "https://github.com/garlictot/bye-distract/blob/master/ios/Runner/AppDelegate.swift"
    click LinuxMain "https://github.com/garlictot/bye-distract/blob/master/linux/runner/main.cc"
    click LinuxApp "https://github.com/garlictot/bye-distract/blob/master/linux/runner/my_application.cc"
    click macOS "https://github.com/garlictot/bye-distract/blob/master/macos/Runner/AppDelegate.swift"
    click Windows "https://github.com/garlictot/bye-distract/blob/master/windows/runner/main.cpp"
    click Web "https://github.com/garlictot/bye-distract/blob/master/web/index.html"
    click Test "https://github.com/garlictot/bye-distract/blob/master/test/widget_test.dart"
    click Pubspec "https://github.com/garlictot/bye-distract/blob/master/pubspec.yaml"

    %% Styles
    classDef ui fill:#D0E6FA,stroke:#0275d8,color:#000
    classDef logic fill:#d4edda,stroke:#28a745,color:#000
    classDef data fill:#ffe5b4,stroke:#fd7e14,color:#000
    classDef engine fill:#e2e3e5,stroke:#6c757d,color:#000
    classDef platform fill:#f0e6f7,stroke:#6f42c1,color:#000
    classDef external fill:#cfe2ff,stroke:#004085,color:#000
    classDef test fill:#f8d7da,stroke:#d63384,color:#000
    classDef manifest fill:#fff3cd,stroke:#856404,color:#000
```
