@@ -13,73 +13,70 @@ class MyApp extends StatelessWidget {
1313 });
1414
1515 @override
16- Widget build (BuildContext context) {
17- return MultiRepositoryProvider (
18- providers: [
19- RepositoryProvider <EmailListRepository >(
20- create: (context) => EmailListRepository (),
21- ),
22- RepositoryProvider <NavigationService >(
23- create: (context) => NavigationService (),
24- ),
25- ],
26- child: MultiBlocProvider (
16+ Widget build (BuildContext context) => MultiRepositoryProvider (
2717 providers: [
28- BlocProvider (
29- create: (context) => ThemeCubit (diContainer. get ()).. loadTheme (),
18+ RepositoryProvider < EmailListRepository > (
19+ create: (context) => EmailListRepository (),
3020 ),
31- BlocProvider (
32- create: (context) => EmailListBloc (
33- messagesRepository:
34- RepositoryProvider .of <EmailListRepository >(context),
35- )..add (
36- EmailListFetched (),
37- ),
38- ),
39- BlocProvider <InitBloc >(
40- create: (_) => InitBloc ()
41- ..add (
42- StartAppEvent (),
43- ),
21+ RepositoryProvider <NavigationService >(
22+ create: (context) => NavigationService (),
4423 ),
4524 ],
46- child: Builder (
47- builder: (context) {
48- final navigator = NavigationService .of (context);
25+ child: MultiBlocProvider (
26+ providers: [
27+ BlocProvider (
28+ create: (context) => ThemeCubit (diContainer.get ())..loadTheme (),
29+ ),
30+ BlocProvider (
31+ create: (context) => EmailListBloc (
32+ messagesRepository:
33+ RepositoryProvider .of <EmailListRepository >(context),
34+ )..add (
35+ EmailListFetched (),
36+ ),
37+ ),
38+ BlocProvider <InitBloc >(
39+ create: (_) => InitBloc ()
40+ ..add (
41+ StartAppEvent (),
42+ ),
43+ ),
44+ ],
45+ child: Builder (
46+ builder: (context) {
47+ final navigator = NavigationService .of (context);
4948
50- return MaterialApp (
51- debugShowCheckedModeBanner: kDebugMode,
52- restorationScopeId: 'app' ,
53- localizationsDelegates: const [
54- S .delegate,
55- GlobalMaterialLocalizations .delegate,
56- GlobalWidgetsLocalizations .delegate,
57- GlobalCupertinoLocalizations .delegate,
58- ],
59- supportedLocales: const [
60- Locale ('en' , '' ), // English, no country code
61- Locale ('de' , '' ), // Ukraine, no country code
62- ],
63- onGenerateTitle: (BuildContext context) => S . of (context).appTitle,
64- theme : context. watch < ThemeCubit >(). getDefaultTheme () ,
65- darkTheme : context.watch <ThemeCubit >().darkTheme ,
66- themeMode : context.watch <ThemeCubit >().themeMode ,
67- navigatorKey : appNavigatorKey ,
68- onGenerateRoute : navigator.onGenerateRoute ,
69- builder : (_, child) {
70- return BlocListener <InitBloc , InitState >(
49+ return MaterialApp (
50+ debugShowCheckedModeBanner: kDebugMode,
51+ restorationScopeId: 'app' ,
52+ localizationsDelegates: const [
53+ S .delegate,
54+ GlobalMaterialLocalizations .delegate,
55+ GlobalWidgetsLocalizations .delegate,
56+ GlobalCupertinoLocalizations .delegate,
57+ ],
58+ supportedLocales: const [
59+ Locale ('en' , '' ), // English, no country code
60+ Locale ('de' , '' ), // Ukraine, no country code
61+ ],
62+ onGenerateTitle: (BuildContext context) =>
63+ S . of (context).appTitle ,
64+ theme : context.watch <ThemeCubit >().getDefaultTheme () ,
65+ darkTheme : context.watch <ThemeCubit >().darkTheme ,
66+ themeMode : context. watch < ThemeCubit >().themeMode ,
67+ navigatorKey : appNavigatorKey ,
68+ onGenerateRoute : navigator.onGenerateRoute,
69+ builder : (_, child) => BlocListener <InitBloc , InitState >(
7170 listener: (_, state) {
7271 if (state is OpenApp ) {
7372 navigator.pushAndRemoveAll (Routes .app);
7473 }
7574 },
7675 child: child,
77- );
78- },
79- );
80- } ,
76+ ),
77+ );
78+ },
79+ ) ,
8180 ),
82- ),
83- );
84- }
81+ );
8582}
0 commit comments