Skip to content

Commit f574b62

Browse files
committed
refactor(app_config): update UI text with l10n
- Replaced hardcoded strings with l10n - Improved UI readability and maintainability - Updated tab labels and descriptions - Updated expansion tile titles and descriptions - Minor formatting improvements
1 parent d0fbac5 commit f574b62

File tree

1 file changed

+64
-60
lines changed

1 file changed

+64
-60
lines changed

lib/app_configuration/view/app_configuration_page.dart

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
6565
child: Text(
6666
l10n.appConfigurationPageDescription,
6767
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
68-
color: Theme.of(context).colorScheme.onSurfaceVariant,
69-
),
68+
color: Theme.of(context).colorScheme.onSurfaceVariant,
69+
),
7070
),
7171
),
7272
TabBar(
7373
controller: _tabController,
7474
tabAlignment: TabAlignment.start,
7575
isScrollable: true,
76-
tabs: const [
77-
Tab(text: 'Feed'),
78-
Tab(text: 'Advertisements'),
79-
Tab(text: 'General'),
76+
tabs: [
77+
Tab(text: l10n.feedTab),
78+
Tab(text: l10n.advertisementsTab),
79+
Tab(text: l10n.generalTab),
8080
],
8181
),
8282
],
@@ -94,8 +94,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
9494
content: Text(
9595
l10n.appConfigSaveSuccessMessage,
9696
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
97-
color: Theme.of(context).colorScheme.onPrimary,
98-
),
97+
color: Theme.of(context).colorScheme.onPrimary,
98+
),
9999
),
100100
backgroundColor: Theme.of(context).colorScheme.primary,
101101
),
@@ -113,8 +113,8 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
113113
content: Text(
114114
state.exception!.toFriendlyMessage(context),
115115
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
116-
color: Theme.of(context).colorScheme.onError,
117-
),
116+
color: Theme.of(context).colorScheme.onError,
117+
),
118118
),
119119
backgroundColor: Theme.of(context).colorScheme.error,
120120
),
@@ -148,7 +148,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
148148
padding: const EdgeInsets.all(AppSpacing.lg),
149149
children: [
150150
ExpansionTile(
151-
title: const Text('User Content & Feed Limits'),
151+
title: Text(l10n.userContentLimitsTitle),
152152
childrenPadding: const EdgeInsets.symmetric(
153153
horizontal: AppSpacing.xxl,
154154
),
@@ -160,7 +160,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
160160
],
161161
),
162162
ExpansionTile(
163-
title: const Text('In-App Action Prompts'),
163+
title: Text(l10n.feedActionsTitle),
164164
childrenPadding: const EdgeInsets.symmetric(
165165
horizontal: AppSpacing.xxl,
166166
),
@@ -174,7 +174,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
174174
padding: const EdgeInsets.all(AppSpacing.lg),
175175
children: [
176176
ExpansionTile(
177-
title: const Text('Advertisement Settings'),
177+
title: Text(l10n.adSettingsTitle),
178178
childrenPadding: const EdgeInsets.symmetric(
179179
horizontal: AppSpacing.xxl,
180180
),
@@ -297,7 +297,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
297297
crossAxisAlignment: CrossAxisAlignment.start,
298298
children: [
299299
Text(
300-
'Set limits on followed items and saved headlines for each user tier.',
300+
l10n.userContentLimitsDescription,
301301
style: Theme.of(context).textTheme.bodySmall?.copyWith(
302302
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
303303
),
@@ -376,7 +376,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
376376
crossAxisAlignment: CrossAxisAlignment.start,
377377
children: [
378378
Text(
379-
'Manage ad frequency and placement for different user roles.',
379+
l10n.adSettingsDescription,
380380
style: Theme.of(context).textTheme.bodySmall?.copyWith(
381381
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
382382
),
@@ -455,7 +455,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
455455
crossAxisAlignment: CrossAxisAlignment.start,
456456
children: [
457457
Text(
458-
'Configure how often to show prompts for actions like rating the app.',
458+
l10n.feedActionsDescription,
459459
style: Theme.of(context).textTheme.bodySmall?.copyWith(
460460
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
461461
),
@@ -511,7 +511,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
511511
) {
512512
final l10n = context.l10n;
513513
return ExpansionTile(
514-
title: const Text('Maintenance Mode'),
514+
title: Text(l10n.maintenanceModeTitle),
515515
childrenPadding: const EdgeInsets.symmetric(
516516
horizontal: AppSpacing.xxl,
517517
vertical: AppSpacing.md,
@@ -521,10 +521,11 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
521521
crossAxisAlignment: CrossAxisAlignment.start,
522522
children: [
523523
Text(
524-
'Enable to show a maintenance screen to all users.',
524+
l10n.maintenanceModeDescription,
525525
style: Theme.of(context).textTheme.bodySmall?.copyWith(
526-
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
527-
),
526+
color:
527+
Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
528+
),
528529
),
529530
const SizedBox(height: AppSpacing.lg),
530531
SwitchListTile(
@@ -533,14 +534,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
533534
value: remoteConfig.appStatus.isUnderMaintenance,
534535
onChanged: (value) {
535536
context.read<AppConfigurationBloc>().add(
536-
AppConfigurationFieldChanged(
537-
remoteConfig: remoteConfig.copyWith(
538-
appStatus: remoteConfig.appStatus.copyWith(
539-
isUnderMaintenance: value,
537+
AppConfigurationFieldChanged(
538+
remoteConfig: remoteConfig.copyWith(
539+
appStatus: remoteConfig.appStatus.copyWith(
540+
isUnderMaintenance: value,
541+
),
542+
),
540543
),
541-
),
542-
),
543-
);
544+
);
544545
},
545546
),
546547
],
@@ -555,7 +556,7 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
555556
) {
556557
final l10n = context.l10n;
557558
return ExpansionTile(
558-
title: const Text('Force App Update'),
559+
title: Text(l10n.forceUpdateTitle),
559560
childrenPadding: const EdgeInsets.symmetric(
560561
horizontal: AppSpacing.xxl,
561562
vertical: AppSpacing.md,
@@ -565,10 +566,11 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
565566
crossAxisAlignment: CrossAxisAlignment.start,
566567
children: [
567568
Text(
568-
'Configure mandatory app updates for users.',
569+
l10n.forceUpdateDescription,
569570
style: Theme.of(context).textTheme.bodySmall?.copyWith(
570-
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
571-
),
571+
color:
572+
Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
573+
),
572574
),
573575
const SizedBox(height: AppSpacing.lg),
574576
_buildTextField(
@@ -578,14 +580,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
578580
value: remoteConfig.appStatus.latestAppVersion,
579581
onChanged: (value) {
580582
context.read<AppConfigurationBloc>().add(
581-
AppConfigurationFieldChanged(
582-
remoteConfig: remoteConfig.copyWith(
583-
appStatus: remoteConfig.appStatus.copyWith(
584-
latestAppVersion: value,
583+
AppConfigurationFieldChanged(
584+
remoteConfig: remoteConfig.copyWith(
585+
appStatus: remoteConfig.appStatus.copyWith(
586+
latestAppVersion: value,
587+
),
588+
),
585589
),
586-
),
587-
),
588-
);
590+
);
589591
},
590592
),
591593
SwitchListTile(
@@ -594,14 +596,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
594596
value: remoteConfig.appStatus.isLatestVersionOnly,
595597
onChanged: (value) {
596598
context.read<AppConfigurationBloc>().add(
597-
AppConfigurationFieldChanged(
598-
remoteConfig: remoteConfig.copyWith(
599-
appStatus: remoteConfig.appStatus.copyWith(
600-
isLatestVersionOnly: value,
599+
AppConfigurationFieldChanged(
600+
remoteConfig: remoteConfig.copyWith(
601+
appStatus: remoteConfig.appStatus.copyWith(
602+
isLatestVersionOnly: value,
603+
),
604+
),
601605
),
602-
),
603-
),
604-
);
606+
);
605607
},
606608
),
607609
_buildTextField(
@@ -611,14 +613,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
611613
value: remoteConfig.appStatus.iosUpdateUrl,
612614
onChanged: (value) {
613615
context.read<AppConfigurationBloc>().add(
614-
AppConfigurationFieldChanged(
615-
remoteConfig: remoteConfig.copyWith(
616-
appStatus: remoteConfig.appStatus.copyWith(
617-
iosUpdateUrl: value,
616+
AppConfigurationFieldChanged(
617+
remoteConfig: remoteConfig.copyWith(
618+
appStatus: remoteConfig.appStatus.copyWith(
619+
iosUpdateUrl: value,
620+
),
621+
),
618622
),
619-
),
620-
),
621-
);
623+
);
622624
},
623625
),
624626
_buildTextField(
@@ -628,14 +630,14 @@ class _AppConfigurationPageState extends State<AppConfigurationPage>
628630
value: remoteConfig.appStatus.androidUpdateUrl,
629631
onChanged: (value) {
630632
context.read<AppConfigurationBloc>().add(
631-
AppConfigurationFieldChanged(
632-
remoteConfig: remoteConfig.copyWith(
633-
appStatus: remoteConfig.appStatus.copyWith(
634-
androidUpdateUrl: value,
633+
AppConfigurationFieldChanged(
634+
remoteConfig: remoteConfig.copyWith(
635+
appStatus: remoteConfig.appStatus.copyWith(
636+
androidUpdateUrl: value,
637+
),
638+
),
635639
),
636-
),
637-
),
638-
);
640+
);
639641
},
640642
),
641643
],
@@ -1329,7 +1331,9 @@ class _AccountActionConfigFormState extends State<_AccountActionConfigForm> {
13291331
),
13301332
value: _getDaysMap(accountActionConfig)[actionType] ?? 0,
13311333
onChanged: (value) {
1332-
final currentMap = _getDaysMap(accountActionConfig);
1334+
final currentMap = Map<FeedActionType, int>.from(
1335+
_getDaysMap(accountActionConfig),
1336+
);
13331337
final updatedMap = Map<FeedActionType, int>.from(currentMap)
13341338
..[actionType] = value;
13351339

0 commit comments

Comments
 (0)