# Shamba AI 🌱
**Instant crop disease & pest diagnosis for Kenyan smallholder farmers.**
Take or upload a photo of a sick leaf or pest → Google Gemini vision returns crop name, disease/pest, confidence, treatments, prevention tips, and a **Kiswahili** summary.
Built with **Flutter** + **Material 3** as a farmer-friendly Android app (also runs on web for demos).
---
## Features
| Feature | Description |
|--------|-------------|
| **Take Photo** | Capture a leaf or pest with the camera |
| **Upload Gallery** | Pick an existing image |
| **AI Diagnosis** | Gemini vision → structured JSON result |
| **Action-first results** | Organic steps first, then chemical options |
| **Confidence meter** | High / medium / low visual ring |
| **Kiswahili summary** | Copy-ready text for WhatsApp sharing |
| **History** | Local Hive store with thumbnails (device only) |
| **Recent scans** | Quick reopen from the Home screen |
| **About** | Privacy notes & agronomist disclaimer |
---
## Screenshots / branding
| Asset | Path |
|-------|------|
| App logo | `assets/images/logo.png` |
| Brand mark | `assets/images/brand_mark.png` |
| Android launcher | `android/app/src/main/res/mipmap-*/ic_launcher.png` |
| Web favicon | `web/favicon.png` |
---
## Tech stack
- **Flutter** 3.22+ (stable)
- **Dart** 3.3+
- **Google Gemini** (`google_generative_ai`) — default model: `gemini-2.5-flash`
- **image_picker** — camera & gallery
- **Hive** — local scan history
- **Material 3** + **Google Fonts (Nunito)**
---
## Project structure
```
shamba_ai/
├── lib/
│ ├── main.dart
│ ├── config/api_config.dart # API key via --dart-define
│ ├── models/ # DiagnosisResult, ScanHistoryItem
│ ├── services/ # Gemini, history, image pickers
│ ├── screens/ # Home, Result, History, About
│ ├── widgets/ # Logo, cards, loading, buttons
│ └── theme/app_theme.dart
├── android/ # Android app …