# elshoram974/gpa-pro architecture

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

- Interactive diagram: https://gitdiagram.com/elshoram974/gpa-pro
- Repository: https://github.com/elshoram974/gpa-pro

## Overview

##### Project Type and Purpose
- This is a cross-platform Flutter application (mobile/web/desktop) named “gpa_pro.”
- Purpose: let users calculate or predict their GPA by entering or guessing subject grades.

##### High-Level File-Structure Analysis
- Top-level folders:
- android, ios, linux, macos, windows, web → platform‐specific shell and build scripts
- lib → application code
- test → automated widget tests
- Inside lib:
- controller → UI event handlers and business logic (one controller per screen or feature)
- view → Flutter widgets organized by feature (screens and reusable widgets)
- data → data layer (models + local (sqflite) and remote (HTTP) datasources)
- core → shared utilities, services (permissions, ads), constants, theming, middleware, localization
- main.dart + routes.dart → app entrypoint and route definitions

##### Key Architecture Patterns
- Layered (Presentation → Controller → Service/Core → Data/Repository → Datasources)
- MVC/MVVM flavor:
- View layer: widgets (view/)
- Controller layer: business logic/state (controller/)
- Data/Repository layer: data providers and models (data/)
- Dependency Injection: core/constants/injections.dart
- State management: use of controllers suggests GetX or similar

##### Main Components
- Presentation Layer
- Screens & Widgets (lib/view)
- Route Manager (routes.dart)
- Controller Layer
- Feature Controllers (lib/controller/…)
- InitialBindings (lib/bindings)
- Core Services & Utilities
- Ads Manager, Permission Service, Network Helper (lib/core/services, core/class)
- Theming & Localization (lib/core/theme, lib/core/localization)
- Middleware (e.g., auth guard)
- Data Layer
- Local Database (sqflite_helper + grade_table_db, subject_table_db)
- Remote API (network helper → HTTP calls for auth, subjects, sharing)
- Models (lib/data/model/*.dart)
- External Dependencies
- SQLite (sqflite)
- REST Backend (user auth & sync)
- Ads SDKs
- PDF generator (core/functions/save/pdf)

##### Relationships & Data Flow
1. User taps UI → View sends event to Controller
2. Controller invokes Core Service or Data Repository
3. Repository chooses Local or Remote Datasource
– Local: read/write from SQLite
– Remote: HTTP GET/POST via network helper
4. Data returns to Controller → Controller updates View state
5. Ads and permissions managed by Core services invoked from Controllers or Middleware

##### Essential Elements Checklist
- Clear labels for every component

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        A["View: Screens"]:::ui
        B["View: Widgets"]:::ui
        C["Route Manager"]:::ui
    end

    subgraph "Controller Layer"
        D["Initial Bindings"]:::controller
        E["Feature Controllers"]:::controller
    end

    subgraph "Core Services & Utilities"
        F["Ads Manager"]:::core
        G["App Open Ads"]:::core
        H["Interstitial Ads"]:::core
        I["Rewarded Ads"]:::core
        J["Permissions Service"]:::core
        K["Network Helper"]:::core
        L["GPA Functions Model"]:::core
        M["PDF Generator"]:::core
    end

    subgraph "Core Theming & Localization"
        N["App Theme"]:::core
        O["Mode Controller"]:::core
        P["Locale Controller"]:::core
        Q["Dictionary AR"]:::core
        R["Dictionary EN"]:::core
    end

    subgraph "Middleware"
        S["Auth Guard"]:::core
    end

    subgraph "Data Layer"
        T["Repositories & Models"]:::data
        U["Sqflite Helper"]:::data
        V["Grade Table DB"]:::data
        W["Subject Table DB"]:::data
        X["Remote API Helper"]:::data
        Y["User Auth Remote"]:::data
        Z["Subjects Remote"]:::data
        AA["Shared Subjects Remote"]:::data
        AB["Data Models"]:::data
    end

    %% Relationships
    A -->|taps| D
    B -->|taps| D
    C -->|navigates| D
    D -->|binds| E
    E -->|calls| K
    E -->|uses| J
    E -->|triggers| M
    E -->|invokes| L
    E -->|loads ads| F
    E -->|loads ads| G
    E -->|loads ads| H
    E -->|loads ads| I
    E -->|routes through| S
    E -->|uses repo| T
    T -->|local access| U
    U -->|manages| V
    U -->|manages| W
    T -->|remote access| X
    X -->|auth API| Y
    X -->|subjects API| Z
    X -->|shared API| AA
    AB -->|models| T
    Y -->|response| X
    Z -->|response| X
    AA -->|response| X
    V -->|data| T
    W -->|data| T
    X -->|data| T
    T -->|data| E
    E -->|updates| A

    %% Click Events
    click A "https://github.com/elshoram974/gpa-pro/tree/main/lib/view/screens"
    click B "https://github.com/elshoram974/gpa-pro/tree/main/lib/view/widgets"
    click C "https://github.com/elshoram974/gpa-pro/blob/main/lib/routes.dart"
    click D "https://github.com/elshoram974/gpa-pro/blob/main/lib/bindings/initial_bindings.dart"
    click E "https://github.com/elshoram974/gpa-pro/tree/main/lib/controller"
    click F "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/ads/class/ads_manger.dart"
    click G "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/ads/class/app_open_ads.dart"
    click H "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/ads/class/interstitial_ads.dart"
    click I "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/ads/class/rewarded_interstitial_ads.dart"
    click J "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/services/permissions.dart"
    click K "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/class/net_helper.dart"
    click L "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/class/gpa_functions_model.dart"
    click M "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/functions/save/pdf/pdf_generator.dart"
    click N "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/theme/app_theme.dart"
    click O "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/theme/controller/mode_controller.dart"
    click P "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/localization/controller/locale_controller.dart"
    click Q "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/localization/dictionary/ar.dart"
    click R "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/localization/dictionary/en.dart"
    click S "https://github.com/elshoram974/gpa-pro/blob/main/lib/core/middleware/middleware.dart"
    click U "https://github.com/elshoram974/gpa-pro/blob/main/lib/data/datasource/database/sqflite_helper.dart"
    click V "https://github.com/elshoram974/gpa-pro/blob/main/lib/data/datasource/database/grades/grade_table_db.dart"
    click W "https://github.com/elshoram974/gpa-pro/blob/main/lib/data/datasource/database/subjects/subject_table_db.dart"
    click X "https://github.com/elshoram974/gpa-pro/blob/main/lib/data/datasource/remote/database_helper.dart"
    click Y "https://github.com/elshoram974/gpa-pro/tree/main/lib/data/datasource/remote/user/auth"
    click Z "https://github.com/elshoram974/gpa-pro/tree/main/lib/data/datasource/remote/subjects"
    click AA "https://github.com/elshoram974/gpa-pro/tree/main/lib/data/datasource/remote/shared"
    click AB "https://github.com/elshoram974/gpa-pro/tree/main/lib/data/model"
    click T "https://github.com/elshoram974/gpa-pro/tree/main/lib/data/repository"
    click `"lib/core/constants/injections.dart"` "lib/core/constants/injections.dart"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#1F618D,color:#1B4F72
    classDef controller fill:#ABEBC6,stroke:#187F4E,color:#145A32
    classDef core fill:#F9E79F,stroke:#B7950B,color:#7D6608
    classDef data fill:#F5B7B1,stroke:#AF601A,color:#873600
```
