2024-11-18 06:44:55 +00:00
|
|
|
import 'package:board_game/board_game.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:key_value_storage/key_value_storage.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:user_repository/user_repository.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(
|
|
|
|
MultiProvider(
|
|
|
|
providers: [
|
|
|
|
// Ton provider UserRepository
|
|
|
|
Provider(
|
|
|
|
create: (context) => LocalUserRepository(
|
|
|
|
keyValueStorage: KeyValueStorage(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// Providers pour la gestion de l'état
|
2024-11-19 20:20:33 +00:00
|
|
|
Provider<PageTransitionsTheme>(
|
|
|
|
create: (_) => PageTransitionsTheme(
|
|
|
|
builders: {
|
|
|
|
TargetPlatform.android: NoTransitionsBuilder(),
|
|
|
|
TargetPlatform.iOS: NoTransitionsBuilder(),
|
|
|
|
TargetPlatform.windows: NoTransitionsBuilder(),
|
|
|
|
TargetPlatform.linux: NoTransitionsBuilder(),
|
|
|
|
TargetPlatform.macOS: NoTransitionsBuilder(),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
2024-11-18 06:44:55 +00:00
|
|
|
ChangeNotifierProvider(create: (context) => CellListProvider()),
|
|
|
|
ChangeNotifierProvider(create: (context) => ArticleListProvider()),
|
|
|
|
ChangeNotifierProvider(create: (context) => SettingsProvider()),
|
|
|
|
ChangeNotifierProvider(
|
2024-11-19 20:20:33 +00:00
|
|
|
create: (context) => UserProvider(
|
|
|
|
context.read<LocalUserRepository>(),
|
|
|
|
),
|
2024-11-18 06:44:55 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
child: const MainApp(), // Maintenant MainApp a accès aux providers
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainApp extends StatelessWidget {
|
|
|
|
const MainApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
theme: context.watch<SettingsProvider>().state.theme,
|
|
|
|
title: 'Little Strategy Game',
|
|
|
|
routes: {
|
|
|
|
'/': (context) => const LoginScreen(),
|
|
|
|
'/lobby': (context) => const Lobby(),
|
|
|
|
'/blog': (context) => const Blog(),
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|