# Phase 3 - App Flutter

## Structure Flutter à créer

```
lib/
├── main.dart                    # Point d'entrée
├── config/
│   ├── api_config.dart         # BaseURL API
│   └── stripe_config.dart      # Stripe public key
├── models/
│   ├── user.dart               # User model
│   ├── campaign.dart           # Campaign model
│   └── donation.dart           # Donation model
├── services/
│   ├── api_service.dart        # HTTP client + endpoints
│   ├── auth_service.dart       # Auth logic
│   └── stripe_service.dart     # Stripe integration
├── screens/
│   ├── auth/
│   │   ├── login_screen.dart
│   │   └── register_screen.dart
│   ├── campaigns/
│   │   ├── home_screen.dart
│   │   ├── campaign_detail_screen.dart
│   │   └── campaign_create_screen.dart
│   ├── dashboard/
│   │   ├── fundraiser_dashboard_screen.dart
│   │   └── donations_screen.dart
│   └── payments/
│       └── payment_screen.dart
├── widgets/
│   ├── campaign_card.dart
│   ├── progress_bar.dart
│   └── donation_form.dart
└── providers/
    ├── auth_provider.dart
    └── campaign_provider.dart
```

## pubspec.yaml dépendances

```yaml
dependencies:
  flutter:
    sdk: flutter
  provider: ^6.0.0
  http: ^1.1.0
  flutter_stripe: ^9.0.0
  shared_preferences: ^2.0.0
  intl: ^0.19.0
  connectivity_plus: ^5.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
```

## Screens MVP

### 1. LoginScreen
- Email + password
- Appel API POST /api/auth/login
- Stockage token SharedPreferences
- Navigation vers HomeScreen

### 2. HomeScreen
- Liste campaigns (FutureBuilder)
- Filtres (category, urgent, search)
- Provider pour gestion état
- Navigation vers DetailScreen

### 3. CampaignDetailScreen
- Infos collecte
- Progress bar
- Liste donations (anonyme)
- Bouton "Contribuer"

### 4. PaymentScreen
- Formulaire amount + infos donateur
- Stripe Flutter plugin
- API call POST /api/campaigns/:id/donate

### 5. FundraiserDashboard
- Mes collectes (list)
- Créer nouvelle collecte (form)
- Mes donations reçues

## Points clés d'intégration

1. **API Configuration**
   - BaseURL : https://dons-dromeardche.fr/api
   - Authentification : Bearer token
   - Headers : Content-Type: application/json

2. **Stripe Setup**
   - Clé publique : récupérer du settings admin
   - PaymentMethod creation
   - Webhook handling côté backend

3. **Storage Local**
   - SharedPreferences pour token JWT
   - Expiration token handling
   - Refresh token logic

4. **State Management**
   - Provider pour AuthService
   - NotifierProvider pour Campaign list
   - Loading states

## Build & Deploy

### Android
```bash
flutter build apk --release
# ou
flutter build appbundle --release  # AAB pour Play Store
```

### iOS
```bash
flutter build ios --release
```

### Play Store
1. Créer compte développeur
2. Signer APK/AAB
3. Upload sur Play Store
4. Fiche app (screenshots, description, politique confidentialité)

## À faire après MVP

- Notifications locales
- Partage native (share_plus)
- Offline mode
- Dark theme
- Animations
