@@ -3,10 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
3
3
import 'package:ht_dashboard/app_configuration/bloc/app_configuration_bloc.dart' ;
4
4
import 'package:ht_dashboard/l10n/app_localizations.dart' ;
5
5
import 'package:ht_dashboard/l10n/l10n.dart' ;
6
- import 'package:ht_dashboard/shared/constants/app_spacing.dart' ;
7
- import 'package:ht_dashboard/shared/widgets/widgets.dart' ;
8
6
import 'package:ht_shared/ht_shared.dart' ;
9
- import 'package:ht_ui_kit/ht_ui_kit.dart' ; // Import for toFriendlyMessage
7
+ import 'package:ht_ui_kit/ht_ui_kit.dart' ;
10
8
11
9
/// {@template app_configuration_page}
12
10
/// A page for managing the application's remote configuration.
@@ -42,7 +40,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
42
40
43
41
@override
44
42
Widget build (BuildContext context) {
45
- final l10n = context.l10n;
43
+ final l10n = AppLocalizationsX ( context) .l10n;
46
44
return Scaffold (
47
45
appBar: AppBar (
48
46
title: Text (
@@ -65,8 +63,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
65
63
child: Text (
66
64
l10n.appConfigurationPageDescription,
67
65
style: Theme .of (context).textTheme.bodyMedium? .copyWith (
68
- color: Theme .of (context).colorScheme.onSurfaceVariant,
69
- ),
66
+ color: Theme .of (context).colorScheme.onSurfaceVariant,
67
+ ),
70
68
),
71
69
),
72
70
TabBar (
@@ -94,8 +92,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
94
92
content: Text (
95
93
l10n.appConfigSaveSuccessMessage,
96
94
style: Theme .of (context).textTheme.bodyMedium? .copyWith (
97
- color: Theme .of (context).colorScheme.onPrimary,
98
- ),
95
+ color: Theme .of (context).colorScheme.onPrimary,
96
+ ),
99
97
),
100
98
backgroundColor: Theme .of (context).colorScheme.primary,
101
99
),
@@ -113,8 +111,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
113
111
content: Text (
114
112
state.exception! .toFriendlyMessage (context),
115
113
style: Theme .of (context).textTheme.bodyMedium? .copyWith (
116
- color: Theme .of (context).colorScheme.onError,
117
- ),
114
+ color: Theme .of (context).colorScheme.onError,
115
+ ),
118
116
),
119
117
backgroundColor: Theme .of (context).colorScheme.error,
120
118
),
@@ -229,7 +227,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
229
227
);
230
228
}
231
229
: null ,
232
- child: Text (context.l10n.discardChangesButton),
230
+ child: Text (AppLocalizationsX ( context) .l10n.discardChangesButton),
233
231
),
234
232
const SizedBox (width: AppSpacing .md),
235
233
ElevatedButton (
@@ -245,7 +243,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
245
243
}
246
244
}
247
245
: null ,
248
- child: Text (context.l10n.saveChangesButton),
246
+ child: Text (AppLocalizationsX ( context) .l10n.saveChangesButton),
249
247
),
250
248
],
251
249
),
@@ -259,17 +257,19 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
259
257
builder: (BuildContext dialogContext) {
260
258
return AlertDialog (
261
259
title: Text (
262
- context.l10n.confirmConfigUpdateDialogTitle,
260
+ AppLocalizationsX ( context) .l10n.confirmConfigUpdateDialogTitle,
263
261
style: Theme .of (dialogContext).textTheme.titleLarge,
264
262
),
265
263
content: Text (
266
- context.l10n.confirmConfigUpdateDialogContent,
264
+ AppLocalizationsX (
265
+ context,
266
+ ).l10n.confirmConfigUpdateDialogContent,
267
267
style: Theme .of (dialogContext).textTheme.bodyMedium,
268
268
),
269
269
actions: < Widget > [
270
270
TextButton (
271
271
onPressed: () => Navigator .of (dialogContext).pop (false ),
272
- child: Text (context.l10n.cancelButton),
272
+ child: Text (AppLocalizationsX ( context) .l10n.cancelButton),
273
273
),
274
274
ElevatedButton (
275
275
onPressed: () => Navigator .of (dialogContext).pop (true ),
@@ -279,7 +279,9 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
279
279
dialogContext,
280
280
).colorScheme.onError,
281
281
),
282
- child: Text (context.l10n.confirmSaveButton),
282
+ child: Text (
283
+ AppLocalizationsX (context).l10n.confirmSaveButton,
284
+ ),
283
285
),
284
286
],
285
287
);
@@ -292,7 +294,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
292
294
BuildContext context,
293
295
RemoteConfig remoteConfig,
294
296
) {
295
- final l10n = context.l10n;
297
+ final l10n = AppLocalizationsX ( context) .l10n;
296
298
return Column (
297
299
crossAxisAlignment: CrossAxisAlignment .start,
298
300
children: [
@@ -371,7 +373,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
371
373
BuildContext context,
372
374
RemoteConfig remoteConfig,
373
375
) {
374
- final l10n = context.l10n;
376
+ final l10n = AppLocalizationsX ( context) .l10n;
375
377
return Column (
376
378
crossAxisAlignment: CrossAxisAlignment .start,
377
379
children: [
@@ -450,7 +452,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
450
452
BuildContext context,
451
453
RemoteConfig remoteConfig,
452
454
) {
453
- final l10n = context.l10n;
455
+ final l10n = AppLocalizationsX ( context) .l10n;
454
456
return Column (
455
457
crossAxisAlignment: CrossAxisAlignment .start,
456
458
children: [
@@ -509,7 +511,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
509
511
BuildContext context,
510
512
RemoteConfig remoteConfig,
511
513
) {
512
- final l10n = context.l10n;
514
+ final l10n = AppLocalizationsX ( context) .l10n;
513
515
return ExpansionTile (
514
516
title: Text (l10n.maintenanceModeTitle),
515
517
childrenPadding: const EdgeInsets .symmetric (
@@ -523,9 +525,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
523
525
Text (
524
526
l10n.maintenanceModeDescription,
525
527
style: Theme .of (context).textTheme.bodySmall? .copyWith (
526
- color:
527
- Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
528
- ),
528
+ color: Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
529
+ ),
529
530
),
530
531
const SizedBox (height: AppSpacing .lg),
531
532
SwitchListTile (
@@ -534,14 +535,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
534
535
value: remoteConfig.appStatus.isUnderMaintenance,
535
536
onChanged: (value) {
536
537
context.read <AppConfigurationBloc >().add (
537
- AppConfigurationFieldChanged (
538
- remoteConfig: remoteConfig.copyWith (
539
- appStatus: remoteConfig.appStatus.copyWith (
540
- isUnderMaintenance: value,
541
- ),
542
- ),
538
+ AppConfigurationFieldChanged (
539
+ remoteConfig: remoteConfig.copyWith (
540
+ appStatus: remoteConfig.appStatus.copyWith (
541
+ isUnderMaintenance: value,
543
542
),
544
- );
543
+ ),
544
+ ),
545
+ );
545
546
},
546
547
),
547
548
],
@@ -554,7 +555,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
554
555
BuildContext context,
555
556
RemoteConfig remoteConfig,
556
557
) {
557
- final l10n = context.l10n;
558
+ final l10n = AppLocalizationsX ( context) .l10n;
558
559
return ExpansionTile (
559
560
title: Text (l10n.forceUpdateTitle),
560
561
childrenPadding: const EdgeInsets .symmetric (
@@ -568,9 +569,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
568
569
Text (
569
570
l10n.forceUpdateDescription,
570
571
style: Theme .of (context).textTheme.bodySmall? .copyWith (
571
- color:
572
- Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
573
- ),
572
+ color: Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
573
+ ),
574
574
),
575
575
const SizedBox (height: AppSpacing .lg),
576
576
_buildTextField (
@@ -580,14 +580,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
580
580
value: remoteConfig.appStatus.latestAppVersion,
581
581
onChanged: (value) {
582
582
context.read <AppConfigurationBloc >().add (
583
- AppConfigurationFieldChanged (
584
- remoteConfig: remoteConfig.copyWith (
585
- appStatus: remoteConfig.appStatus.copyWith (
586
- latestAppVersion: value,
587
- ),
588
- ),
583
+ AppConfigurationFieldChanged (
584
+ remoteConfig: remoteConfig.copyWith (
585
+ appStatus: remoteConfig.appStatus.copyWith (
586
+ latestAppVersion: value,
589
587
),
590
- );
588
+ ),
589
+ ),
590
+ );
591
591
},
592
592
),
593
593
SwitchListTile (
@@ -596,14 +596,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
596
596
value: remoteConfig.appStatus.isLatestVersionOnly,
597
597
onChanged: (value) {
598
598
context.read <AppConfigurationBloc >().add (
599
- AppConfigurationFieldChanged (
600
- remoteConfig: remoteConfig.copyWith (
601
- appStatus: remoteConfig.appStatus.copyWith (
602
- isLatestVersionOnly: value,
603
- ),
604
- ),
599
+ AppConfigurationFieldChanged (
600
+ remoteConfig: remoteConfig.copyWith (
601
+ appStatus: remoteConfig.appStatus.copyWith (
602
+ isLatestVersionOnly: value,
605
603
),
606
- );
604
+ ),
605
+ ),
606
+ );
607
607
},
608
608
),
609
609
_buildTextField (
@@ -613,14 +613,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
613
613
value: remoteConfig.appStatus.iosUpdateUrl,
614
614
onChanged: (value) {
615
615
context.read <AppConfigurationBloc >().add (
616
- AppConfigurationFieldChanged (
617
- remoteConfig: remoteConfig.copyWith (
618
- appStatus: remoteConfig.appStatus.copyWith (
619
- iosUpdateUrl: value,
620
- ),
621
- ),
616
+ AppConfigurationFieldChanged (
617
+ remoteConfig: remoteConfig.copyWith (
618
+ appStatus: remoteConfig.appStatus.copyWith (
619
+ iosUpdateUrl: value,
622
620
),
623
- );
621
+ ),
622
+ ),
623
+ );
624
624
},
625
625
),
626
626
_buildTextField (
@@ -630,14 +630,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
630
630
value: remoteConfig.appStatus.androidUpdateUrl,
631
631
onChanged: (value) {
632
632
context.read <AppConfigurationBloc >().add (
633
- AppConfigurationFieldChanged (
634
- remoteConfig: remoteConfig.copyWith (
635
- appStatus: remoteConfig.appStatus.copyWith (
636
- androidUpdateUrl: value,
637
- ),
638
- ),
633
+ AppConfigurationFieldChanged (
634
+ remoteConfig: remoteConfig.copyWith (
635
+ appStatus: remoteConfig.appStatus.copyWith (
636
+ androidUpdateUrl: value,
639
637
),
640
- );
638
+ ),
639
+ ),
640
+ );
641
641
},
642
642
),
643
643
],
@@ -836,7 +836,7 @@ class _UserPreferenceLimitsFormState extends State<_UserPreferenceLimitsForm> {
836
836
@override
837
837
Widget build (BuildContext context) {
838
838
final userPreferenceConfig = widget.remoteConfig.userPreferenceConfig;
839
- final l10n = context.l10n;
839
+ final l10n = AppLocalizationsX ( context) .l10n;
840
840
841
841
return Column (
842
842
children: [
@@ -1103,7 +1103,7 @@ class _AdConfigFormState extends State<_AdConfigForm> {
1103
1103
@override
1104
1104
Widget build (BuildContext context) {
1105
1105
final adConfig = widget.remoteConfig.adConfig;
1106
- final l10n = context.l10n;
1106
+ final l10n = AppLocalizationsX ( context) .l10n;
1107
1107
1108
1108
return Column (
1109
1109
children: [
@@ -1310,7 +1310,7 @@ class _AccountActionConfigFormState extends State<_AccountActionConfigForm> {
1310
1310
Widget build (BuildContext context) {
1311
1311
final accountActionConfig = widget.remoteConfig.accountActionConfig;
1312
1312
final relevantActionTypes = _getDaysMap (accountActionConfig).keys.toList ();
1313
- final l10n = context.l10n;
1313
+ final l10n = AppLocalizationsX ( context) .l10n;
1314
1314
1315
1315
return Column (
1316
1316
children: relevantActionTypes.map ((actionType) {
0 commit comments