@@ -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,19 @@ 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 (
265+ context,
266+ ).l10n.confirmConfigUpdateDialogContent,
267267 style: Theme .of (dialogContext).textTheme.bodyMedium,
268268 ),
269269 actions: < Widget > [
270270 TextButton (
271271 onPressed: () => Navigator .of (dialogContext).pop (false ),
272- child: Text (context.l10n.cancelButton),
272+ child: Text (AppLocalizationsX ( context) .l10n.cancelButton),
273273 ),
274274 ElevatedButton (
275275 onPressed: () => Navigator .of (dialogContext).pop (true ),
@@ -279,7 +279,9 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
279279 dialogContext,
280280 ).colorScheme.onError,
281281 ),
282- child: Text (context.l10n.confirmSaveButton),
282+ child: Text (
283+ AppLocalizationsX (context).l10n.confirmSaveButton,
284+ ),
283285 ),
284286 ],
285287 );
@@ -292,7 +294,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
292294 BuildContext context,
293295 RemoteConfig remoteConfig,
294296 ) {
295- final l10n = context.l10n;
297+ final l10n = AppLocalizationsX ( context) .l10n;
296298 return Column (
297299 crossAxisAlignment: CrossAxisAlignment .start,
298300 children: [
@@ -371,7 +373,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
371373 BuildContext context,
372374 RemoteConfig remoteConfig,
373375 ) {
374- final l10n = context.l10n;
376+ final l10n = AppLocalizationsX ( context) .l10n;
375377 return Column (
376378 crossAxisAlignment: CrossAxisAlignment .start,
377379 children: [
@@ -450,7 +452,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
450452 BuildContext context,
451453 RemoteConfig remoteConfig,
452454 ) {
453- final l10n = context.l10n;
455+ final l10n = AppLocalizationsX ( context) .l10n;
454456 return Column (
455457 crossAxisAlignment: CrossAxisAlignment .start,
456458 children: [
@@ -509,7 +511,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
509511 BuildContext context,
510512 RemoteConfig remoteConfig,
511513 ) {
512- final l10n = context.l10n;
514+ final l10n = AppLocalizationsX ( context) .l10n;
513515 return ExpansionTile (
514516 title: Text (l10n.maintenanceModeTitle),
515517 childrenPadding: const EdgeInsets .symmetric (
@@ -523,9 +525,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
523525 Text (
524526 l10n.maintenanceModeDescription,
525527 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+ ),
529530 ),
530531 const SizedBox (height: AppSpacing .lg),
531532 SwitchListTile (
@@ -534,14 +535,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
534535 value: remoteConfig.appStatus.isUnderMaintenance,
535536 onChanged: (value) {
536537 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,
543542 ),
544- );
543+ ),
544+ ),
545+ );
545546 },
546547 ),
547548 ],
@@ -554,7 +555,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
554555 BuildContext context,
555556 RemoteConfig remoteConfig,
556557 ) {
557- final l10n = context.l10n;
558+ final l10n = AppLocalizationsX ( context) .l10n;
558559 return ExpansionTile (
559560 title: Text (l10n.forceUpdateTitle),
560561 childrenPadding: const EdgeInsets .symmetric (
@@ -568,9 +569,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
568569 Text (
569570 l10n.forceUpdateDescription,
570571 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+ ),
574574 ),
575575 const SizedBox (height: AppSpacing .lg),
576576 _buildTextField (
@@ -580,14 +580,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
580580 value: remoteConfig.appStatus.latestAppVersion,
581581 onChanged: (value) {
582582 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,
589587 ),
590- );
588+ ),
589+ ),
590+ );
591591 },
592592 ),
593593 SwitchListTile (
@@ -596,14 +596,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
596596 value: remoteConfig.appStatus.isLatestVersionOnly,
597597 onChanged: (value) {
598598 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,
605603 ),
606- );
604+ ),
605+ ),
606+ );
607607 },
608608 ),
609609 _buildTextField (
@@ -613,14 +613,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
613613 value: remoteConfig.appStatus.iosUpdateUrl,
614614 onChanged: (value) {
615615 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,
622620 ),
623- );
621+ ),
622+ ),
623+ );
624624 },
625625 ),
626626 _buildTextField (
@@ -630,14 +630,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
630630 value: remoteConfig.appStatus.androidUpdateUrl,
631631 onChanged: (value) {
632632 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,
639637 ),
640- );
638+ ),
639+ ),
640+ );
641641 },
642642 ),
643643 ],
@@ -836,7 +836,7 @@ class _UserPreferenceLimitsFormState extends State<_UserPreferenceLimitsForm> {
836836 @override
837837 Widget build (BuildContext context) {
838838 final userPreferenceConfig = widget.remoteConfig.userPreferenceConfig;
839- final l10n = context.l10n;
839+ final l10n = AppLocalizationsX ( context) .l10n;
840840
841841 return Column (
842842 children: [
@@ -1103,7 +1103,7 @@ class _AdConfigFormState extends State<_AdConfigForm> {
11031103 @override
11041104 Widget build (BuildContext context) {
11051105 final adConfig = widget.remoteConfig.adConfig;
1106- final l10n = context.l10n;
1106+ final l10n = AppLocalizationsX ( context) .l10n;
11071107
11081108 return Column (
11091109 children: [
@@ -1310,7 +1310,7 @@ class _AccountActionConfigFormState extends State<_AccountActionConfigForm> {
13101310 Widget build (BuildContext context) {
13111311 final accountActionConfig = widget.remoteConfig.accountActionConfig;
13121312 final relevantActionTypes = _getDaysMap (accountActionConfig).keys.toList ();
1313- final l10n = context.l10n;
1313+ final l10n = AppLocalizationsX ( context) .l10n;
13141314
13151315 return Column (
13161316 children: relevantActionTypes.map ((actionType) {
0 commit comments