# axiftaj/flutter-bloc-tutorials architecture

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

- Interactive diagram: https://gitdiagram.com/axiftaj/flutter-bloc-tutorials
- Repository: https://github.com/axiftaj/flutter-bloc-tutorials

## Overview

##### Main Components Identification

a) Presentation Layer (UI)
- Located in the /lib/view directory
- Contains various screens (counter, favourite, login, todo, etc.)

b) BLoC Layer (Business Logic)
- Located in /lib/bloc directory
- Contains multiple BLoCs (counter, favourite, login, todo, etc.)

c) Repository Layer
- Located in /lib/repository
- Contains repositories for posts and favourites
- Should be placed between the BLoC and Data layers

d) Data/Model Layer
- Located in /lib/model
- Contains data models and form validation models

##### Component Relationships

a) User Interface Flow:

b) Business Logic Flow:

c) Data Flow:

##### Specific Features to Highlight

Specialized sections for:
- Image Picker functionality
- Form validation flow
- Authentication flow
- Todo management
- Favourite item management
- Counter functionality
- Switch button state management

##### Technical Details

Annotations for:
- Flutter framework components
- BLoC pattern implementation
- Repository pattern usage
- Model structure and validation
- Utils functionality

##### Additional Elements

- Platform-specific components (iOS/Android)
- External dependencies
- Utility classes
- Configuration files

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef bloc fill:#2ecc71,stroke:#27ae60,color:white
    classDef repo fill:#e67e22,stroke:#d35400,color:white
    classDef model fill:#f1c40f,stroke:#f39c12,color:black
    classDef utils fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        UI[UI Components]:::ui
        BLOC[BLoC Components]:::bloc
        REPO[Repositories]:::repo
        MODEL[Models]:::model
        UTIL[Utils]:::utils
    end

    %% Presentation Layer
    subgraph Presentation
        CounterScreen["Counter Screen"]:::ui
        FavouriteScreen["Favourite Screen"]:::ui
        ImagePickerScreen["Image Picker Screen"]:::ui
        LoginScreen["Login Screen"]:::ui
        TodoScreen["Todo Screen"]:::ui
        SwitchWidget["Switch Widget"]:::ui
    end

    %% BLoC Layer
    subgraph Business_Logic
        CounterBloc["Counter BLoC"]:::bloc
        FavouriteBloc["Favourite BLoC"]:::bloc
        ImagePickerBloc["Image Picker BLoC"]:::bloc
        LoginBloc["Login BLoC"]:::bloc
        PostBloc["Post BLoC"]:::bloc
        SwitchBloc["Switch BLoC"]:::bloc
        TodoBloc["Todo BLoC"]:::bloc
    end

    %% Repository Layer
    subgraph Repositories
        PostRepo["Post Repository"]:::repo
        FavouriteRepo["Favourite Repository"]:::repo
    end

    %% Model Layer
    subgraph Models
        FavouriteModel["Favourite Item Model"]:::model
        PostModel["Post Model"]:::model
        EmailValidation["Email Validation"]:::model
        PasswordValidation["Password Validation"]:::model
        WidgetValidation["Widget Validation"]:::model
    end

    %% Utils
    ImagePickerUtils["Image Picker Utils"]:::utils

    %% Relationships
    CounterScreen --> CounterBloc
    FavouriteScreen --> FavouriteBloc
    ImagePickerScreen --> ImagePickerBloc
    LoginScreen --> LoginBloc
    TodoScreen --> TodoBloc
    SwitchWidget --> SwitchBloc

    FavouriteBloc --> FavouriteRepo
    PostBloc --> PostRepo

    FavouriteRepo --> FavouriteModel
    PostRepo --> PostModel

    LoginBloc --> EmailValidation
    LoginBloc --> PasswordValidation
    LoginBloc --> WidgetValidation

    ImagePickerBloc --> ImagePickerUtils

    %% Click Events
    click CounterScreen "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/view/counter/counter_screen.dart"
    click FavouriteScreen "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/view/favourite/favourite_screen.dart"
    click ImagePickerScreen "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/view/image_picker/image_picker_screen.dart"
    click LoginScreen "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/view/login/login_screen.dart"
    click TodoScreen "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/view/todo/to_do_screen/to_do_screen.dart"
    click SwitchWidget "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/view/switch_button/switch_widget.dart"
    
    click CounterBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/counter_bloc/"
    click FavouriteBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/favourite/"
    click ImagePickerBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/image_picker/"
    click LoginBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/login/"
    click PostBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/post_bloc/"
    click SwitchBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/switch_bloc/"
    click TodoBloc "https://github.com/axiftaj/FLutter-Bloc-Tutorials/tree/main/lib/bloc/todo/"
    
    click PostRepo "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/repository/post_repository.dart"
    click FavouriteRepo "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/repository/favourite_reposiotry.dart"
    
    click FavouriteModel "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/model/favoruite/favourite_item_model.dart"
    click PostModel "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/model/post_model.dart"
    click EmailValidation "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/model/form_validation_model/email.dart"
    click PasswordValidation "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/model/form_validation_model/password.dart"
    click WidgetValidation "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/model/form_validation_model/widget.dart"
    
    click ImagePickerUtils "https://github.com/axiftaj/FLutter-Bloc-Tutorials/blob/main/lib/Utils/image_picker_utils.dart"
```
