Phase 1 du MVP : schéma SQLite porté depuis le prototype web, seed des règles/récompenses, flux d'onboarding en 4 étapes et écran d'accueil minimal. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
732 B
Dart
25 lines
732 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../data/database/app_database.dart';
|
|
import '../data/repositories/onboarding_repository.dart';
|
|
|
|
final databaseProvider = Provider<AppDatabase>((ref) {
|
|
final db = AppDatabase();
|
|
ref.onDispose(db.close);
|
|
return db;
|
|
});
|
|
|
|
final onboardingRepositoryProvider = Provider<OnboardingRepository>((ref) {
|
|
return OnboardingRepository(ref.watch(databaseProvider));
|
|
});
|
|
|
|
final onboardingCompleteProvider = FutureProvider<bool>((ref) async {
|
|
final repo = ref.watch(onboardingRepositoryProvider);
|
|
return repo.isComplete();
|
|
});
|
|
|
|
final childrenProvider = FutureProvider<List<Enfant>>((ref) async {
|
|
final db = ref.watch(databaseProvider);
|
|
return db.listChildren();
|
|
});
|