Skip to content

Commit 852e94d

Browse files
committed
refactor(app_configuration): simplify maintenance config and update UI strings
- Replace MaintenanceConfigForm with a simple SwitchListTile for better maintainability - Update Arabic and English localization strings for app update management and legal information - Remove unused import of MaintenanceConfigForm - Adjust expansion tile titles to use new localized strings
1 parent 5f02ff4 commit 852e94d

File tree

6 files changed

+62
-25
lines changed

6 files changed

+62
-25
lines changed

lib/app_configuration/view/tabs/app_configuration_tab.dart

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:core/core.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/widgets/general_app_config_form.dart';
4-
import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/widgets/maintenance_config_form.dart';
54
import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/widgets/update_config_form.dart';
65
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
76
import 'package:ui_kit/ui_kit.dart';
@@ -45,28 +44,26 @@ class _AppConfigurationTabState extends State<AppConfigurationTab> {
4544
@override
4645
Widget build(BuildContext context) {
4746
final l10n = AppLocalizationsX(context).l10n;
47+
final appConfig = widget.remoteConfig.app;
48+
final maintenanceConfig = appConfig.maintenance;
4849

4950
return ListView(
5051
padding: const EdgeInsets.all(AppSpacing.lg),
5152
children: [
52-
// Maintenance Config
53-
ValueListenableBuilder<int?>(
54-
valueListenable: _expandedTileIndex,
55-
builder: (context, expandedIndex, child) {
56-
const tileIndex = 0;
57-
return ExpansionTile(
58-
key: ValueKey('maintenanceConfigTile_$expandedIndex'),
59-
title: Text(l10n.maintenanceConfigTitle),
60-
onExpansionChanged: (isExpanded) {
61-
_expandedTileIndex.value = isExpanded ? tileIndex : null;
62-
},
63-
initiallyExpanded: expandedIndex == tileIndex,
64-
children: [
65-
MaintenanceConfigForm(
66-
remoteConfig: widget.remoteConfig,
67-
onConfigChanged: widget.onConfigChanged,
53+
// Maintenance Config as a direct SwitchListTile
54+
SwitchListTile(
55+
title: Text(l10n.isUnderMaintenanceLabel),
56+
subtitle: Text(l10n.isUnderMaintenanceDescription),
57+
value: maintenanceConfig.isUnderMaintenance,
58+
onChanged: (value) {
59+
widget.onConfigChanged(
60+
widget.remoteConfig.copyWith(
61+
app: appConfig.copyWith(
62+
maintenance: maintenanceConfig.copyWith(
63+
isUnderMaintenance: value,
64+
),
6865
),
69-
],
66+
),
7067
);
7168
},
7269
),
@@ -79,7 +76,7 @@ class _AppConfigurationTabState extends State<AppConfigurationTab> {
7976
const tileIndex = 1;
8077
return ExpansionTile(
8178
key: ValueKey('updateConfigTile_$expandedIndex'),
82-
title: Text(l10n.updateConfigTitle),
79+
title: Text(l10n.appUpdateManagementTitle),
8380
onExpansionChanged: (isExpanded) {
8481
_expandedTileIndex.value = isExpanded ? tileIndex : null;
8582
},
@@ -102,7 +99,7 @@ class _AppConfigurationTabState extends State<AppConfigurationTab> {
10299
const tileIndex = 2;
103100
return ExpansionTile(
104101
key: ValueKey('generalAppConfigTile_$expandedIndex'),
105-
title: Text(l10n.generalAppConfigTitle),
102+
title: Text(l10n.appLegalInformationTitle),
106103
onExpansionChanged: (isExpanded) {
107104
_expandedTileIndex.value = isExpanded ? tileIndex : null;
108105
},

lib/l10n/app_localizations.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,7 @@ abstract class AppLocalizations {
28912891
/// Tab title for global App settings.
28922892
///
28932893
/// In en, this message translates to:
2894-
/// **'App'**
2894+
/// **'General'**
28952895
String get appTab;
28962896

28972897
/// Tab title for Features settings (Ads, Notifications, etc.).
@@ -3061,6 +3061,18 @@ abstract class AppLocalizations {
30613061
/// In en, this message translates to:
30623062
/// **'Maximum number of headlines this user role can save.'**
30633063
String get savedHeadlinesLimitDescription;
3064+
3065+
/// Title for the Application Update Management expansion tile.
3066+
///
3067+
/// In en, this message translates to:
3068+
/// **'Application Update Management'**
3069+
String get appUpdateManagementTitle;
3070+
3071+
/// Title for the Legal & General Information expansion tile.
3072+
///
3073+
/// In en, this message translates to:
3074+
/// **'Legal & General Information'**
3075+
String get appLegalInformationTitle;
30643076
}
30653077

30663078
class _AppLocalizationsDelegate

lib/l10n/app_localizations_ar.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ class AppLocalizationsAr extends AppLocalizations {
15471547
String get pushNotificationProviderOneSignal => 'OneSignal';
15481548

15491549
@override
1550-
String get appTab => 'التطبيق';
1550+
String get appTab => 'الإعدادات العامة';
15511551

15521552
@override
15531553
String get featuresTab => 'الميزات';
@@ -1643,4 +1643,10 @@ class AppLocalizationsAr extends AppLocalizations {
16431643
@override
16441644
String get savedHeadlinesLimitDescription =>
16451645
'الحد الأقصى لعدد العناوين التي يمكن لهذا الدور المستخدم حفظها.';
1646+
1647+
@override
1648+
String get appUpdateManagementTitle => 'إدارة تحديثات التطبيق';
1649+
1650+
@override
1651+
String get appLegalInformationTitle => 'المعلومات القانونية والعامة';
16461652
}

lib/l10n/app_localizations_en.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ class AppLocalizationsEn extends AppLocalizations {
15501550
String get pushNotificationProviderOneSignal => 'OneSignal';
15511551

15521552
@override
1553-
String get appTab => 'App';
1553+
String get appTab => 'General';
15541554

15551555
@override
15561556
String get featuresTab => 'Features';
@@ -1646,4 +1646,10 @@ class AppLocalizationsEn extends AppLocalizations {
16461646
@override
16471647
String get savedHeadlinesLimitDescription =>
16481648
'Maximum number of headlines this user role can save.';
1649+
1650+
@override
1651+
String get appUpdateManagementTitle => 'Application Update Management';
1652+
1653+
@override
1654+
String get appLegalInformationTitle => 'Legal & General Information';
16491655
}

lib/l10n/arb/app_ar.arb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@
19461946
"@pushNotificationProviderOneSignal": {
19471947
"description": "تسمية مزود الإشعارات الفورية OneSignal"
19481948
},
1949-
"appTab": "التطبيق",
1949+
"appTab": "الإعدادات العامة",
19501950
"@appTab": {
19511951
"description": "عنوان تبويب إعدادات التطبيق العامة."
19521952
},
@@ -2061,5 +2061,13 @@
20612061
"savedHeadlinesLimitDescription": "الحد الأقصى لعدد العناوين التي يمكن لهذا الدور المستخدم حفظها.",
20622062
"@savedHeadlinesLimitDescription": {
20632063
"description": "وصف حد العناوين المحفوظة"
2064+
},
2065+
"appUpdateManagementTitle": "إدارة تحديثات التطبيق",
2066+
"@appUpdateManagementTitle": {
2067+
"description": "عنوان قسم إدارة تحديثات التطبيق القابل للتوسيع."
2068+
},
2069+
"appLegalInformationTitle": "المعلومات القانونية والعامة",
2070+
"@appLegalInformationTitle": {
2071+
"description": "عنوان قسم المعلومات القانونية والعامة القابل للتوسيع."
20642072
}
20652073
}

lib/l10n/arb/app_en.arb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@
19421942
"@pushNotificationProviderOneSignal": {
19431943
"description": "Label for the OneSignal push notification provider"
19441944
},
1945-
"appTab": "App",
1945+
"appTab": "General",
19461946
"@appTab": {
19471947
"description": "Tab title for global App settings."
19481948
},
@@ -2057,5 +2057,13 @@
20572057
"savedHeadlinesLimitDescription": "Maximum number of headlines this user role can save.",
20582058
"@savedHeadlinesLimitDescription": {
20592059
"description": "Description for Saved Headlines Limit"
2060+
},
2061+
"appUpdateManagementTitle": "Application Update Management",
2062+
"@appUpdateManagementTitle": {
2063+
"description": "Title for the Application Update Management expansion tile."
2064+
},
2065+
"appLegalInformationTitle": "Legal & General Information",
2066+
"@appLegalInformationTitle": {
2067+
"description": "Title for the Legal & General Information expansion tile."
20602068
}
20612069
}

0 commit comments

Comments
 (0)