How elshoram974/gpa-pro works
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