# felipegarces17/homework-flutter-gorouter architecture

> Architecture diagram of the GitHub repository felipegarces17/homework-flutter-gorouter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/felipegarces17/homework-flutter-gorouter
- Repository: https://github.com/felipegarces17/homework-flutter-gorouter

## Overview

1. **Repository type and scope**
   - This is a **Flutter cross-platform client app**. The core application logic lives in `lib/`, while `android/`, `ios/`, `web/`, `macos/`, `windows/`, and `linux/` are platform shell projects generated by Flutter.
   - There is no backend service in this repo; all functionality is local UI/state logic.

2. **Top-level architecture**
   - The app is organized as a small **presentation-layer-only** application.
   - Main boundaries are:
     - **App bootstrap** in `lib/main.dart`
     - **Routing/navigation** in `lib/router.dart`
     - **Feature screens** in `lib/screens/`
   - Each calculator lives in its own screen file, keeping feature logic isolated from navigation and startup code.

3. **Entry point and app bootstrap**
   - `lib/main.dart` is the executable entry point.
   - It initializes the Flutter app using `MaterialApp.router`, which means navigation is delegated to the router configuration rather than imperative route pushing.
   - This is the root of the UI tree and the handoff point into the rest of the app.

4. **Navigation subsystem**
   - `lib/router.dart` defines the app’s **GoRouter** setup.
   - The router provides a declarative route map from the home menu to the three feature screens:
     - Home
     - Age calculator
     - BMI calculator
     - Zodiac calculator
   - This is the main navigation boundary: screens do not own route registration; they are mounted by the router.

5. **Home screen as the navigation hub**
   - `lib/screens/home_screen.dart` acts as the **menu and launch pad** for the app.
   - Its main role is to present entry points to the three calculators, likely via buttons or tiles.
   - Architecturally, it is the central coordination UI, but it does not contain the calculation logic itself.

6. **Age calculator feature**
   - `lib/screens/age_screen.dart` is a stateful feature screen centered on **date input** and computed age output.
   - The readme indicates it uses `showDatePicker`, so the data flow is:
     - user selects birth date
     - screen stores date in local state
     - age is derived and rendered in the UI
   - This screen depends on Flutter’s native date picker dialog, which is an important UI/runtime boundary.

7. **BMI calculator feature**
   - `lib/screens/bmi_screen.dart` implements a **form-style calculator** using `TextEditingController`.
   - The likely data flow is:
     - user enters numeric values such as height and weight
     - controllers capture raw input
     - the screen computes BMI and updates the displayed result
   - This screen is stateful because it manages user input and recomputes results on interaction.

8. **Zodiac calculator feature**
   - `lib/screens/zodiac_screen.dart` determines a zodiac sign from a birth date.
   - Like the age screen, its input is date-driven, but the output is categorical rather than numeric.
   - It likely shares the same boundary pattern: local state + date input + derived display result.

9. **State management model**
   - The app uses **local widget state** rather than a global state library.
   - `StatefulWidget` and `setState()` are the primary mechanisms for re-rendering UI after user input.
   - This keeps each feature self-contained and reduces coupling between screens.

10. **Platform integration layer**
    - The `android/`, `ios/`, `macos/`, `windows/`, `linux/`, and `web/` folders contain the platform-specific launchers and build definitions.
    - These layers do not contain app-specific business logic; they adapt the Flutter runtime to each target platform.
    - For architecture diagrams, they can be shown as thin wrappers around the shared Flutter app.

11. **Testing boundary**
    - `test/widget_test.dart` provides Flutter test coverage at the widget level.
    - This implies the app’s testability is focused on UI behavior rather than services or data persistence, which matches the repo’s simple local-logic design.

12. **Build/tooling stack**
    - The project is built with **Flutter 3.41.2**, **Dart 3.11.0**, and **go_router 17.2.1**.
    - `pubspec.yaml` and `pubspec.lock` define dependencies and package resolution.
    - The Android, iOS, desktop, and web folders are managed through standard Flutter build tooling and platform-native project files.

13. **Data flow summary**
    - The app’s flow is straightforward:
      - user enters the app through `main.dart`
      - routing sends them to a screen
      - the screen captures input locally
      - the screen computes a result locally
      - the result is rendered back in the same screen
    - There is no persistence, API integration, or shared domain layer in this repository.

14. **What to emphasize in an architecture diagram**
    - Show a single shared Flutter application core in `lib/`.
    - Place `main.dart` at the entry point, `router.dart` as the navigation hub, and the four screens as feature leaves.
    - Surround that with platform shells for Android/iOS/web/desktop.
    - Represent the calculators as UI-driven components with local state and direct user input/output loops.

Main entry points: [`lib/main.dart`](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/main.dart) (main.dart), [`lib/router.dart`](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/router.dart) (router.dart), [`lib/screens/home_screen.dart`](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/home_screen.dart) (Home), [`lib/screens/age_screen.dart`](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/age_screen.dart) (Age calc)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared_app["Shared app"]
  node_entry["main.dart<br/>entrypoint<br/>[main.dart]"]
  node_router["router.dart<br/>go_router config<br/>[router.dart]"]
  node_home["Home<br/>menu screen<br/>[home_screen.dart]"]
  node_age["Age calc<br/>stateful screen<br/>[age_screen.dart]"]
  node_bmi["BMI calc<br/>form screen<br/>[bmi_screen.dart]"]
  node_zodiac["Zodiac calc<br/>stateful screen<br/>[zodiac_screen.dart]"]
  node_local_state(("Local state<br/>widget state"))
  node_date_picker{{"Date picker<br/>flutter dialog"}}
  node_text_input{{"Inputs<br/>controllers"}}
  node_results(("Results<br/>derived UI"))
end

subgraph group_platform_shells["Platform shells"]
  node_android["Android<br/>host shell"]
  node_ios["iOS<br/>host shell"]
  node_web["Web<br/>host shell"]
  node_macos["macOS<br/>host shell"]
  node_windows["Windows<br/>host shell"]
  node_linux["Linux<br/>host shell"]
end

subgraph group_tooling["Tooling"]
  node_pubspec["pubspec<br/>dependencies<br/>[pubspec.yaml]"]
  node_tests["Widget tests<br/>test suite<br/>[widget_test.dart]"]
end

node_entry -->|"boots"| node_router
node_router -->|"routes"| node_home
node_router -->|"routes"| node_age
node_router -->|"routes"| node_bmi
node_router -->|"routes"| node_zodiac
node_home -->|"launches"| node_age
node_home -->|"launches"| node_bmi
node_home -->|"launches"| node_zodiac
node_age -->|"uses"| node_date_picker
node_zodiac -->|"uses"| node_date_picker
node_bmi -->|"uses"| node_text_input
node_age -->|"updates"| node_local_state
node_bmi -->|"updates"| node_local_state
node_zodiac -->|"updates"| node_local_state
node_local_state -->|"renders"| node_results
node_pubspec -.->|"supports"| node_entry
node_pubspec -.->|"supports"| node_router
node_tests -.->|"covers"| node_entry
node_tests -.->|"covers"| node_home
node_android -.->|"hosts"| node_entry
node_ios -.->|"hosts"| node_entry
node_web -.->|"hosts"| node_entry
node_macos -.->|"hosts"| node_entry
node_windows -.->|"hosts"| node_entry
node_linux -.->|"hosts"| node_entry

click node_entry "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/main.dart"
click node_router "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/router.dart"
click node_home "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/home_screen.dart"
click node_age "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/age_screen.dart"
click node_bmi "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/bmi_screen.dart"
click node_zodiac "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/zodiac_screen.dart"
click node_android "https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/android"
click node_ios "https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/ios"
click node_web "https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/web"
click node_macos "https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/macos"
click node_windows "https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/windows"
click node_linux "https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/linux"
click node_pubspec "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/pubspec.yaml"
click node_tests "https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/test/widget_test.dart"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_router,node_home,node_age,node_bmi,node_zodiac,node_local_state,node_date_picker,node_text_input,node_results toneBlue
class node_android,node_ios,node_web,node_macos,node_windows,node_linux toneAmber
class node_pubspec,node_tests toneMint
```

## Components

### Shared app

Flutter application code and feature screens

- [main.dart](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/main.dart): entrypoint · Flutter app bootstrap and UI root · `lib/main.dart`
- [router.dart](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/router.dart): go_router config · Declarative route map for the app · `lib/router.dart`
- [Home](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/home_screen.dart): menu screen · Launch pad to the calculators · `lib/screens/home_screen.dart`
- [Age calc](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/age_screen.dart): stateful screen · Date picker driven age calculation UI · `lib/screens/age_screen.dart`
- [BMI calc](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/bmi_screen.dart): form screen · Text input BMI calculation UI · `lib/screens/bmi_screen.dart`
- [Zodiac calc](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/lib/screens/zodiac_screen.dart): stateful screen · Birth-date driven zodiac lookup UI · `lib/screens/zodiac_screen.dart`
- **Local state**: widget state · StatefulWidget and setState flow within screens
- **Date picker**: flutter dialog · Native date selection boundary used by date-based screens
- **Inputs**: controllers · TextEditingController driven user entry
- **Results**: derived UI · Computed age BMI or zodiac output rendered on screen

### Platform shells

Generated host projects for each target platform

- [Android](https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/android): host shell · Flutter Android launcher project · `android`
- [iOS](https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/ios): host shell · Flutter iOS launcher project · `ios`
- [Web](https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/web): host shell · Flutter web launcher project · `web`
- [macOS](https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/macos): host shell · Flutter macOS launcher project · `macos`
- [Windows](https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/windows): host shell · Flutter Windows launcher project · `windows`
- [Linux](https://github.com/felipegarces17/homework-flutter-gorouter/tree/main/linux): host shell · Flutter Linux launcher project · `linux`

### Tooling

Build, dependency, and test boundaries

- [pubspec](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/pubspec.yaml): dependencies · Package and version resolution for Flutter and Dart · `pubspec.yaml`
- [Widget tests](https://github.com/felipegarces17/homework-flutter-gorouter/blob/main/test/widget_test.dart): test suite · Widget-level app behavior coverage · `test/widget_test.dart`

## Connections

- main.dart → router.dart: boots · App bootstrap hands off navigation to router
- router.dart → Home: routes · Router mounts the home menu
- router.dart → Age calc: routes · Router mounts the age calculator
- router.dart → BMI calc: routes · Router mounts the BMI calculator
- router.dart → Zodiac calc: routes · Router mounts the zodiac calculator
- Home → Age calc: launches · Home screen links to age calculator
- Home → BMI calc: launches · Home screen links to BMI calculator
- Home → Zodiac calc: launches · Home screen links to zodiac calculator
- Age calc → Date picker: uses · Age screen opens date picker for birth date input
- Zodiac calc → Date picker: uses · Zodiac screen opens date picker for birth date input
- BMI calc → Inputs: uses · BMI screen reads numeric inputs through controllers
- Age calc → Local state: updates · Age screen stores selected date and derived value locally
- BMI calc → Local state: updates · BMI screen recalculates from local widget state
- Zodiac calc → Local state: updates · Zodiac screen stores selected date locally
- Local state → Results: renders · State changes drive derived output display
- pubspec → main.dart: supports · Dependencies and SDK settings support the app
- pubspec → router.dart: supports · go_router dependency enables declarative navigation
- Widget tests → main.dart: covers · Widget tests exercise app startup behavior
- Widget tests → Home: covers · Widget tests can validate visible UI state
- Android → main.dart: hosts · Android shell launches the shared Flutter app
- iOS → main.dart: hosts · iOS shell launches the shared Flutter app
- Web → main.dart: hosts · Web shell launches the shared Flutter app
- macOS → main.dart: hosts · macOS shell launches the shared Flutter app
- Windows → main.dart: hosts · Windows shell launches the shared Flutter app
- Linux → main.dart: hosts · Linux shell launches the shared Flutter app
