How ives97/galeno-public works
Project Type and Purpose
• This is a Flutter‑based mobile application (Android & iOS) for quizzes, user profiles, notifications, ads, and in‑app purchases.
• It has no custom backend code in the repo; it relies on Firebase services (Auth, Firestore, Cloud Messaging), AdMob, local storage, and other external systems.
File Structure and Key Modules
• Native Shells:
– android/… and ios/… directories hold the platform‑specific Runner projects and Gradle/Pods configuration.
• Flutter Core:
– lib/main.dart and lib/app.dart – application entry point and root widget.
• UI Layer:
– lib/pages/… – screen definitions (login, signup, quiz screens, settings, etc.).
– lib/widgets/… and lib/cards/… – reusable UI components.
• State Management:
– lib/blocs/… – BLoC classes (ads_bloc, question_bloc, user_bloc, etc.) implementing the BLoC pattern.
• Service Layer:
– lib/services/… – wrappers for Firebase (auth_service, firebase_service), local storage (sp_service), notifications (notification_service), and common app business logic (app_service).
• Data Models & Configs:
– lib/models/… – Dart model classes (User, Question, Quiz, etc.).
– lib/configs/… – configuration objects for ads, app settings, theming, and supported languages.
• Resources & Assets:
– assets/… – JSON animations, fonts, images, translations, and audio.
• Build & Dependency Files:
– pubspec.yaml, android/build.gradle, ios/Podfile – declare dependencies and configure builds.
Architectural Patterns
• Layered architecture with clear separation:
– Presentation (Flutter UI widgets + Pages)
– Business Logic (BLoCs)
– Data & Integration (Service classes + Models)
• BLoC pattern ensures unidirectional data flow: UI → Events → BLoC → State → UI.
• External service integrations: Firebase for backend functions, AdMob for ads, Shared Preferences for local storage.
Main Components and Interactions
a. Mobile Client (Android/iOS shell)
– Flutter Engine & Dart VM
– Your Dart code (UI, BLoCs, Services)
b. UI Layer
– Pages & Widgets grouped by features (Authentication, Quiz Flow, Profile, Settings, etc.)
c. State Management Layer (BLoCs)
– List each BLoC module or group by domain (UserBloc, QuestionBloc, SettingsBloc, etc.)
d. Service Layer
– FirebaseService (Auth, Firestore)
– NotificationService (FCM)
– AppService (in‑app logic)
– SPService (local storage)
e. Data Layer
– Models and Configs
f. External Systems
– Firebase (Auth, Firestore, Cloud Messaging)
– AdMob / Ad networks
– In‑app purchase providers (if used)
Relationships & Data Flow
• From BLoCs to Services: “Fetch/Update data → Service”.
• From Services to External Systems: “HTTP/SDK calls → Firebase / AdMob / etc.”
Important Design Principles
• Unidirectional data flow (BLoC)
• Layer separation (UI, Business Logic, Data)
• Modularization: group related pages/widgets, group BLoCs by domain
• Dependency inversion: UI depends on abstract bloc interfaces