How shinkaym/trao_doi_do_app works
Project Type and Purpose
• This is a multi-platform Flutter application (“trao_doi_do_app”) targeting Android, iOS, Web, Linux, macOS, and Windows.
• It follows a client-side architecture: Dart code, Flutter framework, and platform-specific embedding. No backend code is present in this repo, but the UI screens (login, register, OTP, forgot password) imply consumption of external authentication APIs.
File-Structure Analysis
• Top-level platform folders: android, ios, linux, macos, windows, web.
• Core application code lives under lib/:
• core/config (flavors, theme mode)
• core/constants (navigation bar, etc.)
• core/di (dependency injection setup)
• core/router (application routing)
• presentation (common screens, feature folders for auth, custom widgets)
• theme (app theme definitions and extensions)
• main.dart and app.dart bootstrap the Flutter app.
• Build and IDE configurations: pubspec.yaml, analysis_options.yaml, Gradle, Xcode, CMake files.
Key Architectural Patterns
• Layered modular structure:
• Presentation layer (UI screens & widgets)
• Core layer (configuration, DI, router)
• Platform embedding (native runners per OS)
• Dependency Injection (likely using get_it or injectable) to decouple services.
• Centralized Router for navigation (auto_route or similar pattern).
• Theming and flavor configuration abstracted into core/config and theme modules.
• Platform Layer (six platform embedders + Flutter Engine)
• Flutter Framework & Dart Runtime
• Application Layer:
• Bootstrap (main.dart → App widget)
• Core/Config & Flavor Manager
• Dependency Injector
• Router (navigation graph)
• Theme Manager
• Presentation modules:
– Auth feature (login, register, OTP, forgot password screens)
– Common screens (not_found)
– Shared widgets (buttons, text fields, scaffold)
• External Services (REST API for authentication)
• (Optional) Local Storage or Secure Storage for tokens
Relationships and Data Flows
• App bootstrap loads DI, config, and router → renders initial screen.
• User interactions on Presentation Widgets → routed by AppRouter → screens obtain services via DI.
• Presentation invokes core services (e.g., AuthService) → sends HTTP requests to External Auth API → returns responses → UI updates.
• Theme Manager provides theme data to widgets.
• Each platform embedder hosts the Flutter engine and routes OS events to the Dart layer.
Final Checklist
• Clear component labels matching file/folder names
• Presentation layer
• Core/config layer
• Platform embedders & Flutter engine
• External services
• Callouts or notes for key architectural patterns (DI, Router, Flavor)