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>
72 lines
2.0 KiB
Dart
72 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'core/theme/app_theme.dart';
|
|
import 'features/dashboard/dashboard_screen.dart';
|
|
import 'features/onboarding/onboarding_flow.dart';
|
|
import 'providers/database_provider.dart';
|
|
|
|
class BonpointApp extends ConsumerStatefulWidget {
|
|
const BonpointApp({super.key});
|
|
|
|
@override
|
|
ConsumerState<BonpointApp> createState() => _BonpointAppState();
|
|
}
|
|
|
|
class _BonpointAppState extends ConsumerState<BonpointApp> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
Future.microtask(() => ref.read(databaseProvider).initialize());
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final onboardingAsync = ref.watch(onboardingCompleteProvider);
|
|
|
|
return MaterialApp(
|
|
title: 'Bons Points',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: AppTheme.light(),
|
|
home: onboardingAsync.when(
|
|
loading: () => const _SplashScreen(),
|
|
error: (_, _) => const OnboardingFlow(),
|
|
data: (complete) =>
|
|
complete ? const DashboardScreen() : const OnboardingFlow(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _SplashScreen extends StatelessWidget {
|
|
const _SplashScreen();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DecoratedBox(
|
|
decoration: const BoxDecoration(gradient: AppTheme.primaryGradient),
|
|
child: Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Text('⭐', style: TextStyle(fontSize: 64)),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Bons Points',
|
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 32),
|
|
const CircularProgressIndicator(color: Colors.white),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|