# uniqueggamal/offline-plant-disease-detection-app architecture

> Architecture diagram of the GitHub repository uniqueggamal/offline-plant-disease-detection-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uniqueggamal/offline-plant-disease-detection-app
- Repository: https://github.com/uniqueggamal/offline-plant-disease-detection-app

## Overview

LeafMate is a Flutter app for offline plant-disease identification and follow-up care. The main workflow is: a user opens the app, captures or selects a leaf image, gets an on-device classification, reviews localized disease guidance, and may save the scan or schedule a reminder. Other documented capabilities include scan history, theme and language settings, onboarding, and Help/About. The README documents the workflow; source excerpts were platform runners rather than Dart runtime code, so uncertain caller-level wiring is omitted.

Main entry points: [`lib/screens/camera/cameraScreen.dart`](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/camera/cameraScreen.dart) (Camera and scan UI), [`lib/main.dart`](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/main.dart) (App entry and routing), [`lib/models/ai_model.dart`](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/ai_model.dart) (TFLite classifier), [`lib/services/db_service.dart`](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/db_service.dart) (Local scan database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App entry and routing<br/>[main.dart]"]
  node_home["Home screen<br/>[home_screen.dart]"]
  node_onboarding["Onboarding"]
end

subgraph group_detection["Leaf detection"]
  node_scan["Camera and scan UI<br/>[cameraScreen.dart]"]
  node_camera["Camera and image input"]
  node_classifier["TFLite classifier<br/>[ai_model.dart]"]
  node_model["Quantized TFLite model"]
  node_classlabels["Disease class labels<br/>[labels.json]"]
end

subgraph group_care["History and care"]
  node_history["Scan history UI"]
  node_detail["Scan detail UI"]
  node_scanmodel["Scan record model"]
  node_database[("Local scan database<br/>[db_service.dart]")]
  node_reminders["Reminder screens"]
  node_remindermodel["Reminder model"]
  node_reminderstate["Reminder state"]
  node_notifications["Local notifications"]
end

subgraph group_preferences["Preferences and guidance"]
  node_cures["Disease guidance<br/>[cure_en.json]"]
  node_localcures["Nepali disease guidance<br/>[cure_ne.json]"]
  node_settings["Settings UI"]
  node_settingsstate["Settings state"]
  node_localization["Localization state"]
  node_apptext["Bilingual app text<br/>[app_text_en.json]"]
  node_nepaliapptext["Nepali app text<br/>[app_text_ne.json]"]
  node_help["Help and About"]
end

node_user(("User"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_home -->|"starts scan"| node_scan
node_scan -->|"captures or selects"| node_camera
node_scan -->|"submits image"| node_classifier
node_classifier -->|"runs inference"| node_model
node_classifier -->|"maps prediction"| node_classlabels
node_classifier -->|"returns prediction"| node_scan
node_scan -->|"loads guidance"| node_cures
node_scan -->|"loads guidance"| node_localcures
node_scan -->|"saves scan"| node_database
node_home -->|"loads recent scans"| node_database
node_history -->|"reads and deletes"| node_database
node_history -->|"opens scan"| node_detail
node_database -->|"stores records"| node_scanmodel
node_reminders -->|"manages reminders"| node_reminderstate
node_reminderstate -->|"maintains"| node_remindermodel
node_reminderstate -->|"schedules"| node_notifications
node_settings -->|"updates preferences"| node_settingsstate
node_settings -->|"changes language"| node_localization
node_localization -->|"loads text"| node_apptext
node_localization -->|"loads text"| node_nepaliapptext
node_app -.->|"provides route"| node_onboarding
node_app -->|"routes to"| node_help

click node_app "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/main.dart"
click node_home "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/home/home_screen.dart"
click node_scan "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/camera/cameraScreen.dart"
click node_camera "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/camera_service.dart"
click node_classifier "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/ai_model.dart"
click node_model "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/ai/models/mobilenetv2_51classes_quant.tflite"
click node_classlabels "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/labels.json"
click node_cures "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/cure_en.json"
click node_localcures "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/cure_ne.json"
click node_history "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/history/history_screen.dart"
click node_detail "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/history/scan_detail_screen.dart"
click node_scanmodel "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/scan_history_model.dart"
click node_database "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/db_service.dart"
click node_reminders "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/reminder/reminder_main_screen.dart"
click node_remindermodel "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/reminder_model.dart"
click node_reminderstate "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/providers/reminder_provider.dart"
click node_notifications "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/notification_service.dart"
click node_settings "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/settings/settings_screen.dart"
click node_settingsstate "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/providers/settings_provider.dart"
click node_localization "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/providers/localization_provider.dart"
click node_apptext "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/app_text_en.json"
click node_nepaliapptext "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/app_text_ne.json"
click node_onboarding "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/onboarding/onboarding_screen.dart"
click node_help "https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/settings/help_support_screen.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_app,node_home,node_onboarding,node_user toneBlue
class node_scan,node_camera,node_classifier,node_model,node_classlabels toneAmber
class node_history,node_detail,node_scanmodel,node_database,node_reminders,node_remindermodel,node_reminderstate,node_notifications toneMint
class node_cures,node_localcures,node_settings,node_settingsstate,node_localization,node_apptext,node_nepaliapptext,node_help toneRose
```

## Components

### App experience

- [App entry and routing](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/main.dart): `lib/main.dart`
- [Home screen](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/home/home_screen.dart): `lib/screens/home/home_screen.dart`
- [Onboarding](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/onboarding/onboarding_screen.dart): `lib/screens/onboarding/onboarding_screen.dart`

### Leaf detection

- [Camera and scan UI](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/camera/cameraScreen.dart): `lib/screens/camera/cameraScreen.dart`
- [Camera and image input](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/camera_service.dart): `lib/services/camera_service.dart`
- [TFLite classifier](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/ai_model.dart): `lib/models/ai_model.dart`
- [Quantized TFLite model](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/ai/models/mobilenetv2_51classes_quant.tflite): `assets/ai/models/mobilenetv2_51classes_quant.tflite`
- [Disease class labels](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/labels.json): `assets/labels/labels.json`

### History and care

- [Scan history UI](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/history/history_screen.dart): `lib/screens/history/history_screen.dart`
- [Scan detail UI](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/history/scan_detail_screen.dart): `lib/screens/history/scan_detail_screen.dart`
- [Scan record model](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/scan_history_model.dart): `lib/models/scan_history_model.dart`
- [Local scan database](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/db_service.dart): `lib/services/db_service.dart`
- [Reminder screens](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/reminder/reminder_main_screen.dart): `lib/screens/reminder/reminder_main_screen.dart`
- [Reminder model](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/models/reminder_model.dart): `lib/models/reminder_model.dart`
- [Reminder state](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/providers/reminder_provider.dart): `lib/providers/reminder_provider.dart`
- [Local notifications](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/services/notification_service.dart): `lib/services/notification_service.dart`

### Preferences and guidance

- [Disease guidance](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/cure_en.json): `assets/labels/cure_en.json`
- [Nepali disease guidance](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/cure_ne.json): `assets/labels/cure_ne.json`
- [Settings UI](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/settings/settings_screen.dart): `lib/screens/settings/settings_screen.dart`
- [Settings state](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/providers/settings_provider.dart): `lib/providers/settings_provider.dart`
- [Localization state](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/providers/localization_provider.dart): `lib/providers/localization_provider.dart`
- [Bilingual app text](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/app_text_en.json): `assets/labels/app_text_en.json`
- [Nepali app text](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/assets/labels/app_text_ne.json): `assets/labels/app_text_ne.json`
- [Help and About](https://github.com/uniqueggamal/offline-plant-disease-detection-app/blob/main/lib/screens/settings/help_support_screen.dart): `lib/screens/settings/help_support_screen.dart`

### Other components

- **User**

## Connections

- User → App entry and routing: opens
- App entry and routing → Home screen: routes to
- Home screen → Camera and scan UI: starts scan
- Camera and scan UI → Camera and image input: captures or selects
- Camera and scan UI → TFLite classifier: submits image
- TFLite classifier → Quantized TFLite model: runs inference
- TFLite classifier → Disease class labels: maps prediction
- TFLite classifier → Camera and scan UI: returns prediction
- Camera and scan UI → Disease guidance: loads guidance
- Camera and scan UI → Nepali disease guidance: loads guidance
- Camera and scan UI → Local scan database: saves scan
- Home screen → Local scan database: loads recent scans
- Scan history UI → Local scan database: reads and deletes
- Scan history UI → Scan detail UI: opens scan
- Local scan database → Scan record model: stores records
- Reminder screens → Reminder state: manages reminders
- Reminder state → Reminder model: maintains
- Reminder state → Local notifications: schedules
- Settings UI → Settings state: updates preferences
- Settings UI → Localization state: changes language
- Localization state → Bilingual app text: loads text
- Localization state → Nepali app text: loads text
- App entry and routing → Onboarding: provides route
- App entry and routing → Help and About: routes to
