# longkhoa0706/fashion_app architecture

> Architecture diagram of the GitHub repository longkhoa0706/fashion_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/longkhoa0706/fashion_app
- Repository: https://github.com/longkhoa0706/fashion_app

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Platform Host"
        Android["Android Host\n(MainActivity)"]:::external
        iOS["iOS Host\n(AppDelegate, Info.plist)"]:::external
    end

    FlutterEngine["Flutter Engine & Plugins\n(pubspec.yaml)"]:::external

    subgraph "Presentation Layer"
        Themes["Theming Constants\n(app_colors.dart, app_font.dart)"]:::ui
        Router["Routing Module\n(routerr.dart, router_path.dart)"]:::ui
        Screens["Screens & Widgets\n(lib/src/view/screen)"]:::ui
    end

    subgraph "ViewModels"
        VM_Product["ProductViewModel"]:::viewmodel
        VM_Cart["CartViewModel"]:::viewmodel
        VM_Auth["AuthViewModel"]:::viewmodel
        VM_Address["AddressViewModel"]:::viewmodel
        VM_BottomNav["BottomNavigateProvider"]:::viewmodel
        VM_ChoiceChip["ChoiceChipViewModel"]:::viewmodel
    end

    subgraph "Data Layer"
        Models["Data Models\n(lib/src/data/model)"]:::services
        Service["ProductService"]:::services
    end

    subgraph "Data Stores"
        Assets["Asset Bundle\n(images, fonts, data.sqlite)"]:::external
        DB["SQLite DB\n(assets/data.sqlite)"]:::external
        API["REST API Endpoint\n(Future)"]:::external
    end

    %% Connections
    Android --> FlutterEngine
    iOS --> FlutterEngine
    FlutterEngine --> Themes
    FlutterEngine --> Screens

    Themes --> Screens

    Screens --> VM_Product
    Screens --> VM_Cart
    Screens --> VM_Auth
    Screens --> VM_Address
    Screens --> VM_BottomNav
    Screens --> VM_ChoiceChip

    VM_Product --> Service
    VM_Cart --> Service
    VM_Auth --> Service
    VM_Address --> Service
    VM_BottomNav --> Service
    VM_ChoiceChip --> Service

    Service --> DB
    DB --> Service
    Assets --> DB

    VM_Product --> Router
    VM_Cart --> Router
    Router --> Screens

    %% Click Events
    click Android "https://github.com/longkhoa0706/fashion_app/blob/master/android/app/src/main/java/com/longkhoa/fashion_app/MainActivity.java"
    click iOS "https://github.com/longkhoa0706/fashion_app/blob/master/ios/Runner/AppDelegate.m"
    click iOS "https://github.com/longkhoa0706/fashion_app/blob/master/ios/Runner/Info.plist"
    click FlutterEngine "https://github.com/longkhoa0706/fashion_app/blob/master/pubspec.yaml"
    click Assets "https://github.com/longkhoa0706/fashion_app/blob/master/assets/data.sqlite"
    click Assets "https://github.com/longkhoa0706/fashion_app/tree/master/assets/image/"
    click Assets "https://github.com/longkhoa0706/fashion_app/tree/master/assets/font/"
    click Router "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/router/routerr.dart"
    click Router "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/router/router_path.dart"
    click Screens "https://github.com/longkhoa0706/fashion_app/tree/master/lib/src/view/screen/"
    click Themes "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/const/app_colors.dart"
    click Themes "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/const/app_font.dart"
    click VM_Product "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/viewmodel/product_viewmodel.dart"
    click VM_Cart "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/viewmodel/cart_viewmodel.dart"
    click VM_Auth "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/viewmodel/auth_viemodel.dart"
    click VM_Address "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/viewmodel/address_viewmodel.dart"
    click VM_BottomNav "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/viewmodel/bottom_navigate_provider.dart"
    click VM_ChoiceChip "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/viewmodel/choice_chip.dart"
    click Models "https://github.com/longkhoa0706/fashion_app/tree/master/lib/src/data/model/"
    click Service "https://github.com/longkhoa0706/fashion_app/blob/master/lib/src/data/service/product_service.dart"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef viewmodel fill:#90EE90,stroke:#333,stroke-width:1px
    classDef services fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
