How longkhoa0706/fashion_app works
Project type and purpose
• This is a cross-platform mobile application built with Flutter/Dart.
• Its primary purpose is to serve as an e-commerce fashion app (browse products, manage cart, checkout, user profiles, orders).
File structure
• Top-level “android/” and “ios/” folders contain native host projects for Android Studio and Xcode—these integrate the Flutter engine.
• “assets/” holds static resources: images, fonts, and a local SQLite DB (data.sqlite).
• “lib/” is the heart of your Flutter app:
• main.dart – application entrypoint, bootstraps Flutter and sets up routing/state management.
• src/data – data layer:
• model/ – domain objects (Product, Cart, Order, Address, etc.)
• service/ – data access services (e.g., ProductService reading from SQLite or remote API)
• src/router – navigation setup (routes, paths).
• src/view – presentation layer: screens and reusable widgets.
• src/viewmodel – business logic/state management (MVVM pattern, using ChangeNotifier/Provider).
• “test/” contains widget tests.
Key insights from README
• It’s an evolving, feature-rich UX based on a Figma design; no backend yet is implied beyond the local SQLite asset.
Main components
a. Platform Host
• Android embedding (Gradle, Manifest, FlutterActivity)
• iOS embedding (Xcode project, AppDelegate, Info.plist)
b. Flutter Engine & Plugins
• Engine runtime that bridges Dart ↔ Native
• Plugins (if any, e.g., path_provider, sqflite)
c. Presentation Layer (UI)
• Widgets & Screens under lib/src/view
• Router component handling navigation
d. State Management (ViewModels)
• ChangeNotifier classes in lib/src/viewmodel
• Provider package (or similar) wiring ViewModels to UI
e. Data Layer
• Models (Product, Category, Cart, Order, Address)
• Services (e.g., ProductService)
• Data store:
– Local SQLite DB (assets/data.sqlite via sqflite plugin)
– Potential future REST API endpoint
f. External/Internal Dependencies
• Pub packages (Flutter SDK, Provider, sqflite, etc.)
• Asset bundles (images, fonts)
Relationships & Interactions
• UI Screen ←binds to→ ViewModel (via Provider)
• ViewModel → invokes → DataService
• DataService ↔ reads/writes ↔ SQLite local DB (or HTTP API)
• Router manages UI flow when ViewModel signals navigation events
• Platform Host ↔ Flutter Engine ↔ Dart code (UI + business logic)
Architectural patterns & principles
• MVVM (Model-View-ViewModel) separation
• Single Responsibility: each ViewModel handles one screen or feature set
• Dependency injection via Provider for ViewModels & Services
• Repository-like Service abstraction (data source swappable between local DB and remote API)
• Asset bundling for offline/static data
Detailed call-outs
• Router component: show how navigation requests flow from ViewModel through Router to UI screens.
• assets/data.sqlite integration via the sqflite plugin.