How ahmednaeim1/style_sphere works
Project type and purpose
• This is a Flutter-based mobile app (Android + iOS) for a shopping/styling experience (“Style Sphere”), featuring authentication, product browsing, cart/checkout, a chatbot, VTO (virtual try-on), and user settings.
• It leverages Firebase (GoogleService-Info), RESTful APIs for selling & VTO, and integrates payment/shipment services.
File structure
• Top-level platform folders: android/, ios/ (native project files & Gradle/Xcode configs)
• lib/ contains all Dart code, split into:
– presentation/: UI screens, widgets, router
– businessLogic/: BLoC & Cubit classes (state management)
– data/: models + repositories (data access)
– constants.dart, main.dart (app bootstrap)
• pubspec.yaml defines dependencies (Flutter SDK, Firebase, BLoC, HTTP, etc.)
README
• We rely primarily on the file tree to infer layering & external services.
Main components
a. Presentation Layer
– Screens & Widgets (login, home, product details, cart, checkout, chatbot, VTO, settings)
– Router (presentation/router.dart)
b. State Management Layer
– BLoCs & Cubits (businessLogic/blocs & /cubits) handling user, products, cart, checkout, chatbot, VTO state
c. Data Layer
– Repositories (data/repositories) implementing CRUD and remote calls
– Models (data/models) representing domain objects
d. External Services & Data Sources
– Firebase Auth/Firestore (via google-services.json)
– REST API endpoints for selling (api_service.dart), VTO processing
– Payment gateway API (payment_repository)
– Shipment service API (shipment_repository)
e. Platform Channels / Native Code
– Android (android/app/src/main/kotlin)
– iOS (ios/Runner/AppDelegate.swift)
f. Assets Store
Relationships and interactions
• UI widgets dispatch events to BLoC/Cubit → BLoC/Cubit invokes corresponding repository → repository makes network/database calls → returns model objects → BLoC/Cubit emits new state → UI rebuilds.
• Authentication flows to Firebase Auth.
• Checkout flows split into Payment and Shipment sub-flows.
• Chatbot & VTO screens call external microservices via HTTP.
Architectural patterns & key design principles
• Layered architecture (Presentation → State → Data → External)
• Repository pattern abstracts data sources.
• BLoC/Cubit for unidirectional data flow (UI ← State).
• Dependency injection via constructors (e.g., injecting repositories into BLoCs).
• Separation of concerns: UI does not deal with raw HTTP or business logic.
Technologies, frameworks & libraries
• Flutter & Dart
• flutter_bloc / bloc
• Firebase Core, Auth, Firestore
• http / dio (for REST calls)
• json_serializable (for model serialization)
• Platform-specific code (Android/Kotlin, iOS/Swift)
• Asset management via pubspec.yaml