# phihung17k/fridge_mobile architecture

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

- Interactive diagram: https://gitdiagram.com/phihung17k/fridge_mobile
- Repository: https://github.com/phihung17k/fridge_mobile

## Overview

##### Main Components Identification
The project is a Flutter mobile application with the following key architectural components:

a. Presentation Layer:
- Pages (UI screens)
- Widgets (Reusable UI components)
- Animations
- Blocs (Business Logic Components)

b. Data Layer:
- Repositories
- Services
- Models
- API Clients

c. Platform-specific Layer:
- Android implementation
- Web implementation

**┌─────────────────────────────────────────────┐**
- UI Layer                    │
- ┬─────────────┬─────────────┤
- Pages       │   Widgets   │ Animations  │
- Home          │ - Loading   │ - Shimmer   │
- Cooking       │ - ItemBlock │ - Sliding   │
- Recipe        │ - Options   │   Gradient  │
- ┬────────┴──────┬──────┴─────────────┘

**┌─────────────────────────────────────────────┐**
- BLoC Layer                      │
- ┬─────────────┬─────────────┤
- Main Bloc      │ Home Bloc   │ Recipe Bloc │
- State/Events   │ State/Events│ State/Events│
- ┬────────┴──────┬──────┴──────┬──────┘

**┌─────────────────────────────────────────────┐**
- Data Layer                      │
- ┬─────────────┬─────────────┤
- Repositories   │  Services   │   Models    │
- App          │ - Ingredient │ - Recipe    │
- Ingredient   │ - API Client │ - Ingredient│
- ┬────────┴──────┬──────┴─────────────┘

**┌─────────────────────────────────────────┐**
- Dependencies                  │
- ┬─────────────┬─────────┤
- App Dependency  │ Bloc Dep    │Page Dep │
- Repository Dep  │ Service Dep │         │
- ┴─────────────┴─────────┘

##### Key Features to Highlight
- BLoC Pattern implementation
- Repository Pattern
- Service Layer abstraction
- Dependency Injection
- Platform-specific implementations

##### Additional Notes
- Clear separation between UI, Business Logic, and Data layers
- Flow of data from API to UI
- Role of BLoCs in state management
- How dependencies are injected
- Error handling flow

Remember to emphasize the Flutter-specific aspects of the architecture, such as the widget tree hierarchy and the BLoC pattern implementation, which are crucial for this mobile application.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef bloc fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef platform fill:#9b59b6,stroke:#8e44ad,color:white

    %% UI Layer
    subgraph UILayer["UI Layer"]
        Pages["Pages"]:::ui
        Widgets["Widgets"]:::ui
        Animations["Animations"]:::ui
        MainApp["Main Application"]:::ui
        Routes["Route Management"]:::ui
        Utils["Utilities"]:::ui
        Assets["Assets Management"]:::ui
    end

    %% BLoC Layer
    subgraph BLoCLayer["BLoC Layer"]
        MainBloc["Main BLoC"]:::bloc
        HomeBloc["Home BLoC"]:::bloc
        RecipeBloc["Recipe BLoC"]:::bloc
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        Repositories["Repositories"]:::data
        Services["Services"]:::data
        Models["Models"]:::data
        APIClients["API Clients"]:::data
    end

    %% Platform Layer
    subgraph PlatformLayer["Platform Layer"]
        Android["Android Implementation"]:::platform
        Web["Web Implementation"]:::platform
    end

    %% Dependencies
    subgraph DependencyLayer["Dependencies"]
        AppDep["App Dependencies"]:::external
        BlocDep["BLoC Dependencies"]:::external
        RepoDep["Repository Dependencies"]:::external
        ServiceDep["Service Dependencies"]:::external
    end

    %% Relationships
    MainApp --> Routes
    MainApp --> Pages
    Pages --> Widgets
    Pages --> Animations
    Pages --> MainBloc
    Pages --> HomeBloc
    Pages --> RecipeBloc
    
    MainBloc --> Repositories
    HomeBloc --> Repositories
    RecipeBloc --> Repositories
    
    Repositories --> Services
    Services --> APIClients
    Services --> Models
    
    AppDep --> MainApp
    BlocDep --> BLoCLayer
    RepoDep --> Repositories
    ServiceDep --> Services

    %% Click Events
    click Pages "https://github.com/phihung17k/fridge_mobile/tree/main/lib/pages/"
    click Widgets "https://github.com/phihung17k/fridge_mobile/tree/main/lib/utils/widgets/"
    click Animations "https://github.com/phihung17k/fridge_mobile/tree/main/lib/animations/"
    click MainBloc "https://github.com/phihung17k/fridge_mobile/tree/main/lib/blocs/"
    click Repositories "https://github.com/phihung17k/fridge_mobile/tree/main/lib/data/repositories/"
    click Services "https://github.com/phihung17k/fridge_mobile/tree/main/lib/data/services/"
    click Models "https://github.com/phihung17k/fridge_mobile/tree/main/lib/data/models/"
    click APIClients "https://github.com/phihung17k/fridge_mobile/tree/main/lib/data/clients/"
    click AppDep "https://github.com/phihung17k/fridge_mobile/tree/main/lib/dependencies/"
    click Android "https://github.com/phihung17k/fridge_mobile/tree/main/android/app/src/main/"
    click MainApp "https://github.com/phihung17k/fridge_mobile/blob/main/lib/main.dart"
    click Routes "https://github.com/phihung17k/fridge_mobile/blob/main/lib/routes.dart"
    click Utils "https://github.com/phihung17k/fridge_mobile/tree/main/lib/utils/"
    click Assets "https://github.com/phihung17k/fridge_mobile/tree/main/assets/"

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        BLOC["BLoC Component"]:::bloc
        DATA["Data Component"]:::data
        EXT["External Component"]:::external
        PLAT["Platform Component"]:::platform
    end
```
