@@ -3,10 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
33import 'package:ht_dashboard/app_configuration/bloc/app_configuration_bloc.dart' ;
44import 'package:ht_dashboard/l10n/app_localizations.dart' ;
55import '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' ;
86import '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' ;
108
119/// {@template app_configuration_page}
1210/// A page for managing the application's remote configuration.
@@ -42,7 +40,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
4240
4341 @override
4442 Widget build (BuildContext context) {
45- final l10n = context.l10n;
43+ final l10n = AppLocalizationsX ( context) .l10n;
4644 return Scaffold (
4745 appBar: AppBar (
4846 title: Text (
@@ -65,8 +63,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
6563 child: Text (
6664 l10n.appConfigurationPageDescription,
6765 style: Theme .of (context).textTheme.bodyMedium? .copyWith (
68- color: Theme .of (context).colorScheme.onSurfaceVariant,
69- ),
66+ color: Theme .of (context).colorScheme.onSurfaceVariant,
67+ ),
7068 ),
7169 ),
7270 TabBar (
@@ -94,8 +92,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
9492 content: Text (
9593 l10n.appConfigSaveSuccessMessage,
9694 style: Theme .of (context).textTheme.bodyMedium? .copyWith (
97- color: Theme .of (context).colorScheme.onPrimary,
98- ),
95+ color: Theme .of (context).colorScheme.onPrimary,
96+ ),
9997 ),
10098 backgroundColor: Theme .of (context).colorScheme.primary,
10199 ),
@@ -113,8 +111,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
113111 content: Text (
114112 state.exception! .toFriendlyMessage (context),
115113 style: Theme .of (context).textTheme.bodyMedium? .copyWith (
116- color: Theme .of (context).colorScheme.onError,
117- ),
114+ color: Theme .of (context).colorScheme.onError,
115+ ),
118116 ),
119117 backgroundColor: Theme .of (context).colorScheme.error,
120118 ),
@@ -229,7 +227,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
229227 );
230228 }
231229 : null ,
232- child: Text (context.l10n.discardChangesButton),
230+ child: Text (AppLocalizationsX ( context) .l10n.discardChangesButton),
233231 ),
234232 const SizedBox (width: AppSpacing .md),
235233 ElevatedButton (
@@ -245,7 +243,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
245243 }
246244 }
247245 : null ,
248- child: Text (context.l10n.saveChangesButton),
246+ child: Text (AppLocalizationsX ( context) .l10n.saveChangesButton),
249247 ),
250248 ],
251249 ),
@@ -259,17 +257,17 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
259257 builder: (BuildContext dialogContext) {
260258 return AlertDialog (
261259 title: Text (
262- context.l10n.confirmConfigUpdateDialogTitle,
260+ AppLocalizationsX ( context) .l10n.confirmConfigUpdateDialogTitle,
263261 style: Theme .of (dialogContext).textTheme.titleLarge,
264262 ),
265263 content: Text (
266- context.l10n.confirmConfigUpdateDialogContent,
264+ AppLocalizationsX ( context) .l10n.confirmConfigUpdateDialogContent,
267265 style: Theme .of (dialogContext).textTheme.bodyMedium,
268266 ),
269267 actions: < Widget > [
270268 TextButton (
271269 onPressed: () => Navigator .of (dialogContext).pop (false ),
272- child: Text (context.l10n.cancelButton),
270+ child: Text (AppLocalizationsX ( context) .l10n.cancelButton),
273271 ),
274272 ElevatedButton (
275273 onPressed: () => Navigator .of (dialogContext).pop (true ),
@@ -279,7 +277,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
279277 dialogContext,
280278 ).colorScheme.onError,
281279 ),
282- child: Text (context.l10n.confirmSaveButton),
280+ child: Text (AppLocalizationsX ( context) .l10n.confirmSaveButton),
283281 ),
284282 ],
285283 );
@@ -292,7 +290,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
292290 BuildContext context,
293291 RemoteConfig remoteConfig,
294292 ) {
295- final l10n = context.l10n;
293+ final l10n = AppLocalizationsX ( context) .l10n;
296294 return Column (
297295 crossAxisAlignment: CrossAxisAlignment .start,
298296 children: [
@@ -371,7 +369,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
371369 BuildContext context,
372370 RemoteConfig remoteConfig,
373371 ) {
374- final l10n = context.l10n;
372+ final l10n = AppLocalizationsX ( context) .l10n;
375373 return Column (
376374 crossAxisAlignment: CrossAxisAlignment .start,
377375 children: [
@@ -450,7 +448,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
450448 BuildContext context,
451449 RemoteConfig remoteConfig,
452450 ) {
453- final l10n = context.l10n;
451+ final l10n = AppLocalizationsX ( context) .l10n;
454452 return Column (
455453 crossAxisAlignment: CrossAxisAlignment .start,
456454 children: [
@@ -509,7 +507,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
509507 BuildContext context,
510508 RemoteConfig remoteConfig,
511509 ) {
512- final l10n = context.l10n;
510+ final l10n = AppLocalizationsX ( context) .l10n;
513511 return ExpansionTile (
514512 title: Text (l10n.maintenanceModeTitle),
515513 childrenPadding: const EdgeInsets .symmetric (
@@ -523,9 +521,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
523521 Text (
524522 l10n.maintenanceModeDescription,
525523 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+ ),
529526 ),
530527 const SizedBox (height: AppSpacing .lg),
531528 SwitchListTile (
@@ -534,14 +531,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
534531 value: remoteConfig.appStatus.isUnderMaintenance,
535532 onChanged: (value) {
536533 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,
543538 ),
544- );
539+ ),
540+ ),
541+ );
545542 },
546543 ),
547544 ],
@@ -554,7 +551,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
554551 BuildContext context,
555552 RemoteConfig remoteConfig,
556553 ) {
557- final l10n = context.l10n;
554+ final l10n = AppLocalizationsX ( context) .l10n;
558555 return ExpansionTile (
559556 title: Text (l10n.forceUpdateTitle),
560557 childrenPadding: const EdgeInsets .symmetric (
@@ -568,9 +565,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
568565 Text (
569566 l10n.forceUpdateDescription,
570567 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+ ),
574570 ),
575571 const SizedBox (height: AppSpacing .lg),
576572 _buildTextField (
@@ -580,14 +576,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
580576 value: remoteConfig.appStatus.latestAppVersion,
581577 onChanged: (value) {
582578 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,
589583 ),
590- );
584+ ),
585+ ),
586+ );
591587 },
592588 ),
593589 SwitchListTile (
@@ -596,14 +592,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
596592 value: remoteConfig.appStatus.isLatestVersionOnly,
597593 onChanged: (value) {
598594 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,
605599 ),
606- );
600+ ),
601+ ),
602+ );
607603 },
608604 ),
609605 _buildTextField (
@@ -613,14 +609,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
613609 value: remoteConfig.appStatus.iosUpdateUrl,
614610 onChanged: (value) {
615611 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,
622616 ),
623- );
617+ ),
618+ ),
619+ );
624620 },
625621 ),
626622 _buildTextField (
@@ -630,14 +626,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
630626 value: remoteConfig.appStatus.androidUpdateUrl,
631627 onChanged: (value) {
632628 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,
639633 ),
640- );
634+ ),
635+ ),
636+ );
641637 },
642638 ),
643639 ],
@@ -836,7 +832,7 @@ class _UserPreferenceLimitsFormState extends State<_UserPreferenceLimitsForm> {
836832 @override
837833 Widget build (BuildContext context) {
838834 final userPreferenceConfig = widget.remoteConfig.userPreferenceConfig;
839- final l10n = context.l10n;
835+ final l10n = AppLocalizationsX ( context) .l10n;
840836
841837 return Column (
842838 children: [
@@ -1103,7 +1099,7 @@ class _AdConfigFormState extends State<_AdConfigForm> {
11031099 @override
11041100 Widget build (BuildContext context) {
11051101 final adConfig = widget.remoteConfig.adConfig;
1106- final l10n = context.l10n;
1102+ final l10n = AppLocalizationsX ( context) .l10n;
11071103
11081104 return Column (
11091105 children: [
@@ -1310,7 +1306,7 @@ class _AccountActionConfigFormState extends State<_AccountActionConfigForm> {
13101306 Widget build (BuildContext context) {
13111307 final accountActionConfig = widget.remoteConfig.accountActionConfig;
13121308 final relevantActionTypes = _getDaysMap (accountActionConfig).keys.toList ();
1313- final l10n = context.l10n;
1309+ final l10n = AppLocalizationsX ( context) .l10n;
13141310
13151311 return Column (
13161312 children: relevantActionTypes.map ((actionType) {
0 commit comments