# Albi 🏥

A health tracking app that respects user privacy. Built with Flutter for Android, allowing users to record weight, blood pressure, and mood data with local storage and optional encrypted cloud backups.

## 🚀 Project Status

**Current Phase**: Phase 1 - Foundation & Core Infrastructure  
**Completed Steps**: 3/18
- ✅ Project Setup and Basic Structure
- ✅ Database Schema and Models
- ✅ Basic Navigation and Theme Setup
- 🔄 **Next**: Core Data Storage Service

## ✨ Features (Current)

- 🎨 **Modern UI**: Material 3 design with comprehensive light/dark theme support
- 🧭 **Navigation**: Bottom navigation with smooth transitions between Home, Add Data, Charts, and Settings
- 📱 **Responsive**: Optimized for mobile devices with health-focused design
- 🔧 **Settings**: Organized preferences for display, data, privacy, and app information
- 🌙 **Theme Toggle**: Easy switching between light and dark modes

## 🔮 Planned Features

- 📊 Weight, Blood Pressure, and Mood tracking
- 📈 Data visualization with charts and trends
- 🔒 Local data encryption (Premium)
- ☁️ Encrypted cloud backup (Premium)
- 📤 Data export/import capabilities
- 🔐 Biometric authentication

## 🛠 Architecture

- **Framework**: Flutter 3.x with Dart
- **State Management**: BLoC pattern
- **Database**: SQLite with sqflite
- **Design**: Material 3 with custom health-focused theming
- **Security**: RSA/AES hybrid encryption (planned)
- **Cloud**: Firebase for backup storage (planned)

## 📋 Prerequisites

- Flutter SDK 3.x
- Android Studio with Flutter plugin
- Android SDK and emulator (for Android testing)
- Xcode (for iOS testing, optional)
- Git for version control

## 🏃‍♂️ How to Test the App

### Option 1: Android Emulator (Recommended)

```bash
# Navigate to project directory
cd /Users/martyn/work/PBB/healthTracker

# Start Android emulator
flutter emulators --launch Medium_Phone_API_36.0

# Wait for emulator to boot, then run the app
flutter run -d emulator-5554
```

### Option 2: iOS Simulator

```bash
# Launch iOS simulator
flutter emulators --launch apple_ios_simulator

# Run on iOS
flutter run -d "iPhone 16 Plus"
```

### Option 3: Web Browser
 
```bash
# Run in Chrome browser
flutter run -d chrome
```

### Option 4: macOS Desktop

```bash
# Run as macOS desktop app
flutter run -d macos
```

### 🔥 Hot Reload Commands (During Development)

While the app is running, use these commands:
- Press `r` for **hot reload** (instantly see code changes)
- Press `R` for **hot restart** (full app restart)
- Press `v` to open **Flutter DevTools** for debugging
- Press `b` to toggle **dark/light mode**
- Press `q` to **quit**

## 🧪 What to Test

### Core Navigation
1. **Bottom Navigation**: Tap between Home, Add Data, Charts, Settings tabs
2. **Page Transitions**: Notice smooth animations between screens
3. **State Persistence**: Tab states should be maintained when switching

### Theme System
1. **Theme Toggle**: Use the sun/moon icon in the app bar
2. **Consistency**: All screens should respect the selected theme
3. **Material 3**: Notice the health-focused green color scheme

### Screen Functionality
1. **Home Screen**:
   - Welcome card with heart icon
   - "Recent Entries" placeholder section
   - "Quick Actions" grid with 4 interactive tiles

2. **Add Data Screen**:
   - Tabbed interface for Weight, Blood Pressure, Mood
   - Proper tab navigation and placeholder content

3. **Charts Screen**:
   - Placeholder cards for future data visualization
   - Information about upcoming features

4. **Settings Screen**:
   - Organized sections: Display, Data, Privacy & Security, About
   - Interactive theme toggle in Display section
   - Placeholder functionality for future features

### Responsive Design
- Try rotating the device (if emulator supports it)
- Test on different screen sizes
- Verify touch targets are appropriately sized

## Releasing
Version Management: Update version : Edit version: X.Y.Z+BUILD in pubspec.yaml
Format : major.minor.patch+buildNumber (e.g., 1.1.8+2)

Build Commands:
# Debug APK (for testing)
flutter build apk --debug

# Release APK (for distribution)
flutter build apk --release

# Release APKs split by ABI (recommended for F-Droid / Play Store)
# Produces separate APKs for armeabi-v7a, arm64-v8a, and x86_64
# Version codes are automatically suffixed: versionCode*10 + abiCode (1/2/3)
flutter build apk --release --split-per-abi

# Or use your script
./build_release.sh

Copy
Testing Commands:
# List available devices
flutter devices

If you don't see your desired emulator, then you may need to start Android Studio and start a device in the device manager section.

# Run on Android emulator
flutter run -d emulator-5554

# Install APK on connected device
flutter install

# Or install specific APK
adb install build/app/outputs/flutter-apk/app-release.apk

## 🚀 Getting Started with Development

1. **Clone and Setup**:
   ```bash
   git clone [repository-url]
   cd healthTracker
   flutter pub get
   ```

2. **Run Tests**:
   ```bash
   flutter test
   ```

3. **Code Analysis**:
   ```bash
   flutter analyze
   ```

4. **Build APK**:
   ```bash
   flutter build apk --debug
   ```

## 📁 Project Structure

```
lib/
├── main.dart                 # App entry point with navigation
├── models/                   # Data models
│   ├── health_data.dart     # Base health data model
│   ├── weight_entry.dart    # Weight tracking model
│   ├── blood_pressure_entry.dart # BP tracking model
│   ├── mood_entry.dart      # Mood tracking model
│   └── mood_type.dart       # Mood enumeration
├── screens/                  # UI screens
│   ├── home_screen.dart     # Dashboard
│   ├── add_data_screen.dart # Data entry
│   ├── charts_screen.dart   # Visualization
│   └── settings_screen.dart # Preferences
├── widgets/                  # Reusable components
│   ├── bottom_nav_bar.dart  # Navigation bar
│   └── shared_app_bar.dart  # Consistent app bar
├── services/                 # Business logic
│   └── database_service.dart # SQLite operations
└── utils/                    # Utilities
    ├── constants.dart       # App constants
    └── unit_converter.dart  # Unit conversions
```

## 🧪 Testing

- **Unit Tests**: 15/15 passing (models, services, utilities)
- **Widget Tests**: Included for basic functionality
- **Integration Tests**: Planned for future development phases

Run all tests:
```bash
flutter test
```

## 📈 Development Roadmap

See `design/plan.md` for the complete 18-step development blueprint and `design/todo.md` for detailed progress tracking.

### Next Steps (Phase 1 completion):
- **Step 4**: Core Data Storage Service with BLoC integration
- **Step 5**: Weight Tracking Implementation
- **Step 6**: Blood Pressure Recording
- **Step 7**: Mood Tracking with Emoji Selection
- **Step 8**: Data Validation and Error Handling

## 🤝 Contributing

1. Follow the established patterns in existing code
2. Maintain test coverage for new features
3. Ensure all code passes `flutter analyze`
4. Test on both light and dark themes
5. Follow the step-by-step development plan

## 📄 License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

Copyright 2026 Private By Design

## 🆘 Support

For help getting started with Flutter development:
- [Flutter Documentation](https://docs.flutter.dev/)
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
