@@ -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,17 @@ 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 ( context) .l10n.confirmConfigUpdateDialogContent,
267
265
style: Theme .of (dialogContext).textTheme.bodyMedium,
268
266
),
269
267
actions: < Widget > [
270
268
TextButton (
271
269
onPressed: () => Navigator .of (dialogContext).pop (false ),
272
- child: Text (context.l10n.cancelButton),
270
+ child: Text (AppLocalizationsX ( context) .l10n.cancelButton),
273
271
),
274
272
ElevatedButton (
275
273
onPressed: () => Navigator .of (dialogContext).pop (true ),
@@ -279,7 +277,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
279
277
dialogContext,
280
278
).colorScheme.onError,
281
279
),
282
- child: Text (context.l10n.confirmSaveButton),
280
+ child: Text (AppLocalizationsX ( context) .l10n.confirmSaveButton),
283
281
),
284
282
],
285
283
);
@@ -292,7 +290,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
292
290
BuildContext context,
293
291
RemoteConfig remoteConfig,
294
292
) {
295
- final l10n = context.l10n;
293
+ final l10n = AppLocalizationsX ( context) .l10n;
296
294
return Column (
297
295
crossAxisAlignment: CrossAxisAlignment .start,
298
296
children: [
@@ -371,7 +369,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
371
369
BuildContext context,
372
370
RemoteConfig remoteConfig,
373
371
) {
374
- final l10n = context.l10n;
372
+ final l10n = AppLocalizationsX ( context) .l10n;
375
373
return Column (
376
374
crossAxisAlignment: CrossAxisAlignment .start,
377
375
children: [
@@ -450,7 +448,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
450
448
BuildContext context,
451
449
RemoteConfig remoteConfig,
452
450
) {
453
- final l10n = context.l10n;
451
+ final l10n = AppLocalizationsX ( context) .l10n;
454
452
return Column (
455
453
crossAxisAlignment: CrossAxisAlignment .start,
456
454
children: [
@@ -509,7 +507,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
509
507
BuildContext context,
510
508
RemoteConfig remoteConfig,
511
509
) {
512
- final l10n = context.l10n;
510
+ final l10n = AppLocalizationsX ( context) .l10n;
513
511
return ExpansionTile (
514
512
title: Text (l10n.maintenanceModeTitle),
515
513
childrenPadding: const EdgeInsets .symmetric (
@@ -523,9 +521,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
523
521
Text (
524
522
l10n.maintenanceModeDescription,
525
523
style: Theme .of (context).textTheme.bodySmall? .copyWith (
526
- color:
527
- Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
528
- ),
524
+ color: Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
525
+ ),
529
526
),
530
527
const SizedBox (height: AppSpacing .lg),
531
528
SwitchListTile (
@@ -534,14 +531,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
534
531
value: remoteConfig.appStatus.isUnderMaintenance,
535
532
onChanged: (value) {
536
533
context.read <AppConfigurationBloc >().add (
537
- AppConfigurationFieldChanged (
538
- remoteConfig: remoteConfig.copyWith (
539
- appStatus: remoteConfig.appStatus.copyWith (
540
- isUnderMaintenance: value,
541
- ),
542
- ),
534
+ AppConfigurationFieldChanged (
535
+ remoteConfig: remoteConfig.copyWith (
536
+ appStatus: remoteConfig.appStatus.copyWith (
537
+ isUnderMaintenance: value,
543
538
),
544
- );
539
+ ),
540
+ ),
541
+ );
545
542
},
546
543
),
547
544
],
@@ -554,7 +551,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
554
551
BuildContext context,
555
552
RemoteConfig remoteConfig,
556
553
) {
557
- final l10n = context.l10n;
554
+ final l10n = AppLocalizationsX ( context) .l10n;
558
555
return ExpansionTile (
559
556
title: Text (l10n.forceUpdateTitle),
560
557
childrenPadding: const EdgeInsets .symmetric (
@@ -568,9 +565,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
568
565
Text (
569
566
l10n.forceUpdateDescription,
570
567
style: Theme .of (context).textTheme.bodySmall? .copyWith (
571
- color:
572
- Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
573
- ),
568
+ color: Theme .of (context).colorScheme.onSurface.withOpacity (0.7 ),
569
+ ),
574
570
),
575
571
const SizedBox (height: AppSpacing .lg),
576
572
_buildTextField (
@@ -580,14 +576,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
580
576
value: remoteConfig.appStatus.latestAppVersion,
581
577
onChanged: (value) {
582
578
context.read <AppConfigurationBloc >().add (
583
- AppConfigurationFieldChanged (
584
- remoteConfig: remoteConfig.copyWith (
585
- appStatus: remoteConfig.appStatus.copyWith (
586
- latestAppVersion: value,
587
- ),
588
- ),
579
+ AppConfigurationFieldChanged (
580
+ remoteConfig: remoteConfig.copyWith (
581
+ appStatus: remoteConfig.appStatus.copyWith (
582
+ latestAppVersion: value,
589
583
),
590
- );
584
+ ),
585
+ ),
586
+ );
591
587
},
592
588
),
593
589
SwitchListTile (
@@ -596,14 +592,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
596
592
value: remoteConfig.appStatus.isLatestVersionOnly,
597
593
onChanged: (value) {
598
594
context.read <AppConfigurationBloc >().add (
599
- AppConfigurationFieldChanged (
600
- remoteConfig: remoteConfig.copyWith (
601
- appStatus: remoteConfig.appStatus.copyWith (
602
- isLatestVersionOnly: value,
603
- ),
604
- ),
595
+ AppConfigurationFieldChanged (
596
+ remoteConfig: remoteConfig.copyWith (
597
+ appStatus: remoteConfig.appStatus.copyWith (
598
+ isLatestVersionOnly: value,
605
599
),
606
- );
600
+ ),
601
+ ),
602
+ );
607
603
},
608
604
),
609
605
_buildTextField (
@@ -613,14 +609,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
613
609
value: remoteConfig.appStatus.iosUpdateUrl,
614
610
onChanged: (value) {
615
611
context.read <AppConfigurationBloc >().add (
616
- AppConfigurationFieldChanged (
617
- remoteConfig: remoteConfig.copyWith (
618
- appStatus: remoteConfig.appStatus.copyWith (
619
- iosUpdateUrl: value,
620
- ),
621
- ),
612
+ AppConfigurationFieldChanged (
613
+ remoteConfig: remoteConfig.copyWith (
614
+ appStatus: remoteConfig.appStatus.copyWith (
615
+ iosUpdateUrl: value,
622
616
),
623
- );
617
+ ),
618
+ ),
619
+ );
624
620
},
625
621
),
626
622
_buildTextField (
@@ -630,14 +626,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
630
626
value: remoteConfig.appStatus.androidUpdateUrl,
631
627
onChanged: (value) {
632
628
context.read <AppConfigurationBloc >().add (
633
- AppConfigurationFieldChanged (
634
- remoteConfig: remoteConfig.copyWith (
635
- appStatus: remoteConfig.appStatus.copyWith (
636
- androidUpdateUrl: value,
637
- ),
638
- ),
629
+ AppConfigurationFieldChanged (
630
+ remoteConfig: remoteConfig.copyWith (
631
+ appStatus: remoteConfig.appStatus.copyWith (
632
+ androidUpdateUrl: value,
639
633
),
640
- );
634
+ ),
635
+ ),
636
+ );
641
637
},
642
638
),
643
639
],
@@ -836,7 +832,7 @@ class _UserPreferenceLimitsFormState extends State<_UserPreferenceLimitsForm> {
836
832
@override
837
833
Widget build (BuildContext context) {
838
834
final userPreferenceConfig = widget.remoteConfig.userPreferenceConfig;
839
- final l10n = context.l10n;
835
+ final l10n = AppLocalizationsX ( context) .l10n;
840
836
841
837
return Column (
842
838
children: [
@@ -1103,7 +1099,7 @@ class _AdConfigFormState extends State<_AdConfigForm> {
1103
1099
@override
1104
1100
Widget build (BuildContext context) {
1105
1101
final adConfig = widget.remoteConfig.adConfig;
1106
- final l10n = context.l10n;
1102
+ final l10n = AppLocalizationsX ( context) .l10n;
1107
1103
1108
1104
return Column (
1109
1105
children: [
@@ -1310,7 +1306,7 @@ class _AccountActionConfigFormState extends State<_AccountActionConfigForm> {
1310
1306
Widget build (BuildContext context) {
1311
1307
final accountActionConfig = widget.remoteConfig.accountActionConfig;
1312
1308
final relevantActionTypes = _getDaysMap (accountActionConfig).keys.toList ();
1313
- final l10n = context.l10n;
1309
+ final l10n = AppLocalizationsX ( context) .l10n;
1314
1310
1315
1311
return Column (
1316
1312
children: relevantActionTypes.map ((actionType) {
0 commit comments