# wasifibnharun/bmi-calculator-app architecture

> Architecture diagram of the GitHub repository wasifibnharun/bmi-calculator-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wasifibnharun/bmi-calculator-app
- Repository: https://github.com/wasifibnharun/bmi-calculator-app

## Overview

#### Purpose and Runtime
A standalone Flutter Android BMI calculator. It accepts height in centimeters and weight in kilograms, computes BMI locally, classifies the result, and presents it with animated UI. There is no backend, persistence layer, authentication, or external API; the only named package integration is `gauge_indicator`.

Primary Dart runtime entry point: `lib/main.dart`. Android embeds the Flutter runtime through `android/app/src/main/kotlin/com/bmi/calculator/bmi_calculator/MainActivity.kt`.

#### Application Bootstrap and Navigation
`lib/main.dart` initializes the Material 3 application, global theme/color usage, and initial route/widget. The app begins at the animated splash screen, which transitions with replacement navigation to the calculator, preventing return to splash via back navigation.

Core paths:
- `lib/main.dart`
- `lib/screens/splash_screen.dart`
- `lib/core/colors/app_colors.dart`

#### Splash Stage
`SplashScreen` is a stateful, animation-driven entry stage. It owns an `AnimationController` via `SingleTickerProviderStateMixin` and combines fade/scale animation before invoking `Navigator.pushReplacement` to enter the calculator flow.

Boundary: splash owns only timed visual entry and navigation; BMI input/result state begins after the destination calculator screen is created.

Core path:
- `lib/screens/splash_screen.dart`

#### Calculator State and Domain Flow
`BmiCalculatorScreen` is the central state owner. It coordinates input values, form validation, calculated BMI, derived category, and reset behavior using `StatefulWidget`/`setState`.

Primary control flow:
1. User enters height and weight.
2. Form validation rejects empty or invalid values inline.
3. Screen converts cm to meters and computes `weightKg / heightMeters²`.
4. BMI thresholds derive Underweight, Normal, Overweight, or Obese plus a category color.
5. Updated state renders the result card and reference legend.
6. Reset clears form fields and result state.

Core path:
- `lib/screens/bmi_calculator_screen.dart`

#### Input Boundary
The input component encapsulates height/weight field presentation and validation feedback, while the calculator screen retains submission, calculation, and result-state authority. This separates raw text/form concerns from BMI business decisions.

Core paths:
- `lib/widgets/input_card.dart`
- `lib/screens/bmi_calculator_screen.dart`

#### Result Visualization
`ResultCard` converts calculated state into the user-facing BMI score, category badge, and radial gauge. The gauge is animated and implemented through the external `gauge_indicator` Flutter package. It should receive already-calculated BMI/category data rather than recalculate domain logic.

Core paths:
- `lib/widgets/result_card.dart`
- `lib/screens/bmi_calculator_screen.dart`
- `pubspec.yaml`

#### Shared Visual Semantics
The centralized palette supplies application and BMI-category colors, ensuring calculator classification, result badge/gauge, and legend can use consistent visual semantics. The reference table is a static explanation of the same category thresholds/colors, always visible in the calculator UI.

Core paths:
- `lib/core/colors/app_colors.dart`
- `lib/widgets/bmi_reference_table.dart`
- `lib/widgets/result_card.dart`

#### Platform and Build Boundary
Flutter/Dart contains application behavior and UI. The Android Gradle project packages it as an Android app, with manifest and native launcher integration; it does not contain BMI logic.

Core paths:
- `android/app/src/main/AndroidManifest.xml`
- `android/app/src/main/kotlin/com/bmi/calculator/bmi_calculator/MainActivity.kt`
- `android/app/build.gradle.kts`

Main entry points: [`lib/screens/bmi_calculator_screen.dart`](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart) (BMI calculator), [`lib/core/colors/app_colors.dart`](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/core/colors/app_colors.dart) (App colors), [`lib/main.dart`](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/main.dart) (App bootstrap), [`lib/widgets/result_card.dart`](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/result_card.dart) (Result card)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flutter["Flutter application"]
  node_main["App bootstrap<br/>Flutter entry point<br/>[main.dart]"]
  node_colors["App colors<br/>Shared palette<br/>[app_colors.dart]"]
  node_splash["Splash screen<br/>Animated entry screen<br/>[splash_screen.dart]"]
  node_calculator["BMI calculator<br/>Stateful screen"]
  node_input_card["Input card<br/>Form component<br/>[input_card.dart]"]
  node_bmi_calculation{{"BMI calculation<br/>Local domain flow"}}
  node_classification{{"BMI classification<br/>Threshold rules"}}
  node_result_card["Result card<br/>Result visualization<br/>[result_card.dart]"]
  node_reference_table["BMI reference table<br/>Static legend"]
  node_gauge_indicator{{"gauge_indicator<br/>Flutter package<br/>[pubspec.yaml]"}}
end

subgraph group_android["Android packaging"]
  node_android_manifest["Android manifest<br/>Android metadata"]
  node_gradle_build["App Gradle build<br/>[build.gradle.kts]"]
  node_main_activity["MainActivity<br/>Android launcher<br/>[MainActivity.kt]"]
end

node_gradle_build -->|"packages"| node_android_manifest
node_android_manifest -->|"launches"| node_main_activity
node_main_activity -->|"hosts Flutter"| node_main
node_main -->|"applies theme"| node_colors
node_main -->|"initial screen"| node_splash
node_splash -->|"replacement navigation"| node_calculator
node_calculator -->|"renders fields"| node_input_card
node_input_card -->|"validated input"| node_calculator
node_calculator -->|"submits values"| node_bmi_calculation
node_bmi_calculation -->|"BMI value"| node_classification
node_classification -->|"category state"| node_calculator
node_calculator -->|"calculated result"| node_result_card
node_calculator -->|"renders legend"| node_reference_table
node_colors -->|"category colors"| node_classification
node_colors -->|"visual semantics"| node_result_card
node_colors -->|"legend colors"| node_reference_table
node_gauge_indicator -->|"animated gauge"| node_result_card

click node_android_manifest "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/android/app/src/main/AndroidManifest.xml"
click node_gradle_build "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/android/app/build.gradle.kts"
click node_main_activity "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/android/app/src/main/kotlin/com/bmi/calculator/bmi_calculator/MainActivity.kt"
click node_main "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/main.dart"
click node_colors "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/core/colors/app_colors.dart"
click node_splash "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/splash_screen.dart"
click node_calculator "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart"
click node_input_card "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/input_card.dart"
click node_bmi_calculation "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart"
click node_classification "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart"
click node_result_card "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/result_card.dart"
click node_reference_table "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/bmi_reference_table.dart"
click node_gauge_indicator "https://github.com/wasifibnharun/bmi-calculator-app/blob/main/pubspec.yaml"

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_main,node_colors,node_splash,node_calculator,node_input_card,node_bmi_calculation,node_classification,node_result_card,node_reference_table,node_gauge_indicator toneBlue
class node_android_manifest,node_gradle_build,node_main_activity toneAmber
```

## Components

### Flutter application

Local BMI calculation and animated UI.

- [App bootstrap](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/main.dart): Flutter entry point · Initializes Material 3 theme and starts the splash screen. · `lib/main.dart`
- [App colors](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/core/colors/app_colors.dart): Shared palette · Defines application and BMI-category colors. · `lib/core/colors/app_colors.dart`
- [Splash screen](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/splash_screen.dart): Animated entry screen · Owns timed fade/scale animation and replacement navigation. · `lib/screens/splash_screen.dart`
- [BMI calculator](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart): Stateful screen · Owns form submission, BMI state, classification, and reset. · `lib/screens/bmi_calculator_screen.dart`
- [Input card](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/input_card.dart): Form component · Presents height and weight fields with validation feedback. · `lib/widgets/input_card.dart`
- [BMI calculation](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart): Local domain flow · Converts cm to meters and calculates weight / height². · `lib/screens/bmi_calculator_screen.dart`
- [BMI classification](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/screens/bmi_calculator_screen.dart): Threshold rules · Derives category and category color from BMI. · `lib/screens/bmi_calculator_screen.dart`
- [Result card](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/result_card.dart): Result visualization · Renders score, category badge, and animated radial gauge. · `lib/widgets/result_card.dart`
- [BMI reference table](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/lib/widgets/bmi_reference_table.dart): Static legend · Explains category thresholds and colors. · `lib/widgets/bmi_reference_table.dart`
- [gauge_indicator](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/pubspec.yaml): Flutter package · Provides the animated radial gauge. · `pubspec.yaml`

### Android packaging

Native launcher and Gradle packaging boundary.

- [Android manifest](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/android/app/src/main/AndroidManifest.xml): Android metadata · `android/app/src/main/AndroidManifest.xml`
- [App Gradle build](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/android/app/build.gradle.kts): Gradle build · `android/app/build.gradle.kts`
- [MainActivity](https://github.com/wasifibnharun/bmi-calculator-app/blob/main/android/app/src/main/kotlin/com/bmi/calculator/bmi_calculator/MainActivity.kt): Android launcher · Embeds the Flutter runtime. · `android/app/src/main/kotlin/com/bmi/calculator/bmi_calculator/MainActivity.kt`

## Connections

- App Gradle build → Android manifest: packages
- Android manifest → MainActivity: launches
- MainActivity → App bootstrap: hosts Flutter
- App bootstrap → App colors: applies theme
- App bootstrap → Splash screen: initial screen
- Splash screen → BMI calculator: replacement navigation
- BMI calculator → Input card: renders fields
- Input card → BMI calculator: validated input
- BMI calculator → BMI calculation: submits values
- BMI calculation → BMI classification: BMI value
- BMI classification → BMI calculator: category state
- BMI calculator → Result card: calculated result
- BMI calculator → BMI reference table: renders legend
- App colors → BMI classification: category colors
- App colors → Result card: visual semantics
- App colors → BMI reference table: legend colors
- gauge_indicator → Result card: animated gauge
