How huraira-younas/content_scripter works
Project Type and Purpose
• This is a cross-platform mobile application (Flutter) named “content_scripter.”
• It provides chat/assistant features, user authentication, membership management, history, trending searches, on-boarding, etc.
• The code is structured with UI screens, shared widgets, state-management (Bloc/Cubit), service layer (REST API), and native Android/iOS wrappers.
File Structure
Top-level folders:
– android/ & ios/: Native platform projects generated by Flutter.
– lib/: The heart of the app
• screens/: All UI pages grouped by feature (auth, chat, history, membership, account, etc.)
• common_widget/: Reusable UI components (buttons, dialogs, loaders, etc.)
• blocs/ & cubits/: Business-logic/state layer (Bloc and Cubit implementations)
• models/: Data models for JSON serialization/deserialization
• services/: api_service.dart & api_routes.dart for REST calls
• custom_routes/: Custom page-transition logic
• main.dart & routes.dart: App entry-point & navigation setup
– assets/: Static resources (fonts, images)
– test/: Widget/unit tests
Pulling in Insights from the README
Your goal is to represent a layered mobile-app architecture plus the native shells:
a. Main Components
1. Presentation Layer
– Flutter UI Screens (lib/screens/...)
– Shared Widgets (lib/common_widget)
– Navigation (lib/routes.dart + custom_routes)
2. State-Management Layer
– Cubits (lib/cubits/…): simple state controllers
– Blocs (lib/blocs/…): events → states
3. Data Layer
– Models (lib/models/…)
– Services (lib/services/api_service.dart & api_routes.dart)
4. Platform Layer (Flutter Engine ↔ Native)
– Android (android/)
– iOS (ios/)
5. External Services
– REST API backend (authentication, chat/assistant, membership, history, etc.)
b. Relationships & Interactions
– UI Screens dispatch events (or call methods) on Cubits/Blocs.
– Cubits/Blocs fetch/persist data via Services, transforming JSON ↔ Models.
– Services communicate over HTTP to the External REST API.
– Models flow up to Blocs/Cubits, then to UI.
– Assets (fonts/images) are consumed by UI Components.
– main.dart bootstraps and wires up the navigation & initial Cubits/Blocs.
– Flutter Engine runs atop the native shells in android/ & ios/.
c. Architectural Patterns & Principles
– Layered architecture (Presentation → State → Data → External).
– Separation of concerns (UI vs. state vs. data).
– Bloc/Cubit for reactive state management.
– Modularization: features grouped into folders.
– Reusable components in common_widget to avoid duplication.
d. Key Technologies & Frameworks
– Flutter SDK & Dart language
– flutter_bloc or bloc libraries for Bloc/Cubit
– http or dio (via api_service) for networking
– JSON serialization for models
– Flutter’s Navigator 2.0 (routes.dart + custom_routes)
Putting It All Together
[Native Android/iOS] → [Flutter Engine] → [main.dart & routes]
↓
[UI Screens & Widgets] ↔ [Cubits & Blocs] ↔ [Models & Services] ↔ [External API]