# anirban6311/stadium_app-state-management- architecture

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

- Interactive diagram: https://gitdiagram.com/anirban6311/stadium_app-state-management-
- Repository: https://github.com/anirban6311/stadium_app-state-management-

## Overview

##### Project Type and Purpose
- This is a cross-platform Flutter application (mobile, web, desktop) named “hero_animation” (per Android package).
- It helps users browse stadium information, manage wishlists, plan visits, take notes, view country posts, and see about-screen details—all orchestrated via rich animations.
- It uses feature-based modules with the BLoC pattern, local persistence (db_helper.dart), and external data (PostsRepo).

##### File Structure
- Top-level folders for each build target: android/, ios/, web/, windows/, macos/, linux/
- lib/: core Dart code
- data/: shared data models and helpers (db_helper.dart, app_overview_data.dart, stadiums_data.dart, planned_items.dart, wishlist_items.dart)
- features/: seven feature folders (about, country, home, notes, planned, splash_screen, stadium_view, wishlist), each containing:
– bloc/ (about_bloc.dart, posts_bloc.dart, etc.)
– ui/ (about_page.dart, posts_page.dart, etc.)
– models/ and repos/ where applicable (country/models, country/repos/posts_repo.dart)
- main.dart: single entry point
- assets/: JSON animations & images
- config/build files: pubspec.yaml, android/gradle.*, ios/Runner.xcodeproj, etc.

##### Architectural Patterns
- Feature-first modularization: each feature encapsulates its UI, BLoC, and models
- BLoC pattern for event→state state management (flutter_bloc)
- Repository pattern isolates data-access logic (PostsRepo, local DB via db_helper)
- Single entry point (main.dart) sets up navigation and dependency providers

##### Main Components
a. Presentation Layer (UI)
– Screens & Widgets (home_page.dart, stadium_view.dart, notes_page.dart, etc.)
– Asset Loader (loads JSON animations & images)
b. State-Management Layer
– BLoC per feature (HomeBloc, StadiumViewBloc, NotesBloc, PostsBloc, AboutBloc, PlannedBloc, WishlistBloc, SplashScreen has no BLoC)
c. Data / Repository Layer
– Repositories (PostsRepo for country data, db_helper for local SQLite)
– Data Sources:
- Local DB (db_helper.dart → SQLite)
- Remote API (PostsRepo → HTTP)
- Static Assets (stadiums_data.dart, JSON animations)
d. Platform Layer
– Flutter Engine + Platform Channels
– Build targets (android/, ios/, web/, windows/, macos/, linux/)

##### Relationships & Interactions
1. User interacts with UI → UI dispatches Event →
2. BLoC receives Event → Business Logic → calls Repository →
3. Repository chooses Data Source → fetches/mutates data (Local DB or Remote HTTP or Asset) →
4. Repository returns Model → BLoC emits new State →
5. UI subscribes to State stream and rebuilds

##### Essential Elements
- Clear labels on every component (e.g. “WishlistBloc”, “db_helper.sqlite”)
- Modular boundaries (feature outlines)
- Platform build targets grouped around the Flutter Engine

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% App Entry Point
    Main["main.dart"]:::entry
    click Main "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/main.dart"

    %% User Interaction
    UserTap["User Tap"]:::user

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        HomeUI["Home Screen UI"]:::ui
        click HomeUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/home/ui/home.dart"
        StadiumUI["Stadium View UI"]:::ui
        click StadiumUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/stadium_view/ui/stadium_view.dart"
        NotesUI["Notes Screen UI"]:::ui
        click NotesUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/notes/ui/notes_page.dart"
        PlannedUI["Planned Visits UI"]:::ui
        click PlannedUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/planned/ui/planned_page.dart"
        WishlistUI["Wishlist UI"]:::ui
        click WishlistUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/wishlist/ui/wishlist_page.dart"
        AboutUI["About Screen UI"]:::ui
        click AboutUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/about/ui/about_page.dart"
        CountryPostsUI["Country Posts UI"]:::ui
        click CountryPostsUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/country/ui/posts_page.dart"
        CountrySearchUI["Country Search UI"]:::ui
        click CountrySearchUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/country/ui/search_country_page.dart"
        SplashUI["Splash Screen UI"]:::ui
        click SplashUI "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/splash_screen/ui/splash_screen.dart"
    end

    %% State Management Layer
    subgraph "State-Management Layer"
        direction TB
        HomeBloc["HomeBloc"]:::bloc
        click HomeBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/home/bloc/home_bloc.dart"
        StadiumBloc["StadiumViewBloc"]:::bloc
        click StadiumBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/stadium_view/bloc/stadium_view_bloc.dart"
        NotesBloc["NotesBloc"]:::bloc
        click NotesBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/notes/bloc/notes_bloc.dart"
        PlannedBloc["PlannedBloc"]:::bloc
        click PlannedBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/planned/bloc/planned_bloc.dart"
        WishlistBloc["WishlistBloc"]:::bloc
        click WishlistBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/wishlist/bloc/wishlist_bloc.dart"
        AboutBloc["AboutBloc"]:::bloc
        click AboutBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/about/bloc/about_bloc.dart"
        PostsBloc["PostsBloc"]:::bloc
        click PostsBloc "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/country/bloc/bloc/posts_bloc.dart"
    end

    %% Repository Layer
    subgraph "Repository Layer"
        direction TB
        PostsRepo["PostsRepo"]:::repo
        click PostsRepo "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/features/country/repos/posts_repo.dart"
        DBHelper["Local DB Helper"]:::repo
        click DBHelper "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/data/db_helper.dart"
    end

    %% Data Sources
    subgraph "Data Sources"
        direction TB
        DB[(SQLite Database)]:::db
        StaticStadiums["Stadiums Data"]:::asset
        click StaticStadiums "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/data/stadiums_data.dart"
        StaticOverview["Overview Data"]:::asset
        click StaticOverview "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/data/app_overview_data.dart"
        PlannedModel["Planned Items Model"]:::asset
        click PlannedModel "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/data/planned_items.dart"
        WishlistModel["Wishlist Items Model"]:::asset
        click WishlistModel "https://github.com/anirban6311/stadium_app-state-management-/blob/master/lib/data/wishlist_items.dart"
        HTTPAPI["HTTP API"]:::remote
    end

    %% Assets
    subgraph "Assets"
        direction TB
        Animations["Animations JSON"]:::asset
        click Animations "https://github.com/anirban6311/stadium_app-state-management-/blob/master/assets/animations/*.json"
        Images["Images"]:::asset
        click Images "https://github.com/anirban6311/stadium_app-state-management-/tree/master/assets/images/"
    end

    %% Platform Layer
    subgraph "Platform Layer"
        direction TB
        FlutterEngine["Flutter Engine"]:::platform
        Android["Android"]:::platform
        click Android "https://github.com/anirban6311/stadium_app-state-management-/tree/master/android/"
        iOS["iOS"]:::platform
        click iOS "https://github.com/anirban6311/stadium_app-state-management-/tree/master/ios/"
        Web["Web"]:::platform
        click Web "https://github.com/anirban6311/stadium_app-state-management-/tree/master/web/"
        Windows["Windows"]:::platform
        click Windows "https://github.com/anirban6311/stadium_app-state-management-/tree/master/windows/"
        MacOS["macOS"]:::platform
        click MacOS "https://github.com/anirban6311/stadium_app-state-management-/tree/master/macos/"
        Linux["Linux"]:::platform
        click Linux "https://github.com/anirban6311/stadium_app-state-management-/tree/master/linux/"
    end

    %% Flows
    Main -->|launches| SplashUI
    UserTap -->|navigates| HomeUI
    UserTap --> StadiumUI
    UserTap --> NotesUI
    UserTap --> PlannedUI
    UserTap --> WishlistUI
    UserTap --> AboutUI
    UserTap --> CountryPostsUI
    UserTap --> CountrySearchUI

    HomeUI -->|dispatch Event| HomeBloc
    StadiumUI -->|dispatch Event| StadiumBloc
    NotesUI -->|dispatch Event| NotesBloc
    PlannedUI -->|dispatch Event| PlannedBloc
    WishlistUI -->|dispatch Event| WishlistBloc
    AboutUI -->|dispatch Event| AboutBloc
    CountryPostsUI -->|dispatch Event| PostsBloc
    CountrySearchUI -->|dispatch Event| PostsBloc

    HomeBloc -->|query Local DB| DBHelper
    StadiumBloc -->|read Static Data| DBHelper
    NotesBloc -->|query Local DB| DBHelper
    PlannedBloc -->|query Local DB| DBHelper
    WishlistBloc -->|query Local DB| DBHelper
    AboutBloc -->|read Static Assets| DBHelper
    PostsBloc -->|HTTP GET /posts| PostsRepo

    DBHelper -->|queries| DB
    DBHelper -->|reads| StaticStadiums
    DBHelper -->|reads| StaticOverview
    DBHelper -->|reads| PlannedModel
    DBHelper -->|reads| WishlistModel

    PostsRepo -->|fetch| HTTPAPI

    HomeUI --> Animations
    StadiumUI --> Animations
    NotesUI --> Animations
    PlannedUI --> Animations
    WishlistUI --> Animations
    AboutUI --> Animations
    CountryPostsUI --> Images
    CountrySearchUI --> Images

    FlutterEngine --> Android
    FlutterEngine --> iOS
    FlutterEngine --> Web
    FlutterEngine --> Windows
    FlutterEngine --> MacOS
    FlutterEngine --> Linux

    %% Styles
    classDef ui fill:#d0e7ff,stroke:#0366d6,color:#0366d6;
    classDef bloc fill:#d6f5d6,stroke:#28a745,color:#28a745;
    classDef repo fill:#fff4cc,stroke:#e69500,color:#e69500;
    classDef db fill:#ffe6cc,stroke:#ff8c00,color:#ff8c00;
    classDef remote fill:#f3e6ff,stroke:#800080,color:#800080;
    classDef asset fill:#f0f0f0,stroke:#6a737d,color:#6a737d;
    classDef platform fill:#eeeeee,stroke:#586069,color:#586069;
    classDef entry fill:#ffeef0,stroke:#d73a49,color:#d73a49;
    classDef user fill:#f1f8ff,stroke:#1a73e8,color:#1a73e8;
```
