@@ -4,28 +4,33 @@ import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
4
4
import 'package:flutter/material.dart' ;
5
5
import 'package:flutter_bloc/flutter_bloc.dart' ;
6
6
import 'package:flutter_localized_locales/flutter_localized_locales.dart' ;
7
+ import 'package:go_router/go_router.dart' ;
8
+
9
+ const _restorationScopeId = 'rootVoices' ;
7
10
8
11
final class AppContent extends StatelessWidget {
9
12
const AppContent ({super .key});
10
13
14
+ List <LocalizationsDelegate <dynamic >> get _localizationsDelegates {
15
+ return const [
16
+ ...VoicesLocalizations .localizationsDelegates,
17
+ LocaleNamesLocalizationsDelegate (),
18
+ ];
19
+ }
20
+
11
21
@override
12
22
Widget build (BuildContext context) {
23
+ final l10n = context.l10n;
13
24
return BlocListener <AuthenticationBloc , AuthenticationState >(
14
25
listener: (context, state) {},
15
26
child: MaterialApp .router (
16
- restorationScopeId: 'rootVoices' ,
17
- localizationsDelegates: const [
18
- ...VoicesLocalizations .localizationsDelegates,
19
- LocaleNamesLocalizationsDelegate (),
20
- ],
27
+ restorationScopeId: _restorationScopeId,
28
+ localizationsDelegates: _localizationsDelegates,
21
29
supportedLocales: VoicesLocalizations .supportedLocales,
22
30
localeListResolutionCallback: basicLocaleListResolution,
23
- routerConfig: AppRouter .init (
24
- authenticationBloc: context.read <AuthenticationBloc >(),
25
- ),
26
- title: 'Catalyst Voices' ,
31
+ routerConfig: _routeConfig (context),
32
+ title: l10n.homeScreenText,
27
33
theme: ThemeData (
28
- useMaterial3: true ,
29
34
brightness: Brightness .dark,
30
35
bottomNavigationBarTheme: const BottomNavigationBarThemeData (
31
36
type: BottomNavigationBarType .fixed,
@@ -34,4 +39,10 @@ final class AppContent extends StatelessWidget {
34
39
),
35
40
);
36
41
}
42
+
43
+ GoRouter _routeConfig (BuildContext context) {
44
+ return AppRouter .init (
45
+ authenticationBloc: context.read <AuthenticationBloc >(),
46
+ );
47
+ }
37
48
}
0 commit comments