Skip to content

Commit c7b7a61

Browse files
committed
refactor(app_configuration): restructure app status and updates settings
- Combine maintenance mode and app updates into a single settings section - Rename "General App Config" to "App URLs" - Reorganize settings tiles and their respective indices
1 parent b92956d commit c7b7a61

File tree

1 file changed

+51
-33
lines changed

1 file changed

+51
-33
lines changed

lib/app_configuration/view/tabs/app_configuration_tab.dart

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,39 +44,17 @@ class _AppConfigurationTabState extends State<AppConfigurationTab> {
4444
@override
4545
Widget build(BuildContext context) {
4646
final l10n = AppLocalizationsX(context).l10n;
47-
final appConfig = widget.remoteConfig.app;
48-
final maintenanceConfig = appConfig.maintenance;
4947

5048
return ListView(
5149
padding: const EdgeInsets.all(AppSpacing.lg),
5250
children: [
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-
),
65-
),
66-
),
67-
);
68-
},
69-
),
70-
const SizedBox(height: AppSpacing.lg),
71-
72-
// Update Config
7351
ValueListenableBuilder<int?>(
7452
valueListenable: _expandedTileIndex,
7553
builder: (context, expandedIndex, child) {
76-
const tileIndex = 1;
54+
const tileIndex = 0;
7755
return ExpansionTile(
78-
key: ValueKey('updateConfigTile_$expandedIndex'),
79-
title: Text(l10n.appUpdateManagementTitle),
56+
key: ValueKey('appStatusAndUpdatesTile_$expandedIndex'),
57+
title: Text(l10n.appStatusAndUpdatesTitle),
8058
onExpansionChanged: (isExpanded) {
8159
_expandedTileIndex.value = isExpanded ? tileIndex : null;
8260
},
@@ -88,24 +66,64 @@ class _AppConfigurationTabState extends State<AppConfigurationTab> {
8866
),
8967
expandedCrossAxisAlignment: CrossAxisAlignment.start,
9068
children: [
91-
UpdateConfigForm(
92-
remoteConfig: widget.remoteConfig,
93-
onConfigChanged: widget.onConfigChanged,
69+
ExpansionTile(
70+
title: Text(l10n.maintenanceModeTitle),
71+
childrenPadding: const EdgeInsetsDirectional.only(
72+
start: AppSpacing.lg,
73+
top: AppSpacing.md,
74+
bottom: AppSpacing.md,
75+
),
76+
expandedCrossAxisAlignment: CrossAxisAlignment.start,
77+
children: [
78+
SwitchListTile(
79+
title: Text(l10n.isUnderMaintenanceLabel),
80+
subtitle: Text(l10n.isUnderMaintenanceDescription),
81+
value: widget
82+
.remoteConfig
83+
.app
84+
.maintenance
85+
.isUnderMaintenance,
86+
onChanged: (value) {
87+
widget.onConfigChanged(
88+
widget.remoteConfig.copyWith(
89+
app: widget.remoteConfig.app.copyWith(
90+
maintenance: widget.remoteConfig.app.maintenance
91+
.copyWith(isUnderMaintenance: value),
92+
),
93+
),
94+
);
95+
},
96+
),
97+
],
98+
),
99+
const SizedBox(height: AppSpacing.lg),
100+
ExpansionTile(
101+
title: Text(l10n.appUpdateManagementTitle),
102+
childrenPadding: const EdgeInsetsDirectional.only(
103+
start: AppSpacing.lg,
104+
top: AppSpacing.md,
105+
bottom: AppSpacing.md,
106+
),
107+
expandedCrossAxisAlignment: CrossAxisAlignment.start,
108+
children: [
109+
UpdateConfigForm(
110+
remoteConfig: widget.remoteConfig,
111+
onConfigChanged: widget.onConfigChanged,
112+
),
113+
],
94114
),
95115
],
96116
);
97117
},
98118
),
99119
const SizedBox(height: AppSpacing.lg),
100-
101-
// General App Config
102120
ValueListenableBuilder<int?>(
103121
valueListenable: _expandedTileIndex,
104122
builder: (context, expandedIndex, child) {
105-
const tileIndex = 2;
123+
const tileIndex = 1;
106124
return ExpansionTile(
107-
key: ValueKey('generalAppConfigTile_$expandedIndex'),
108-
title: Text(l10n.appLegalInformationTitle),
125+
key: ValueKey('appUrlsTile_$expandedIndex'),
126+
title: Text(l10n.appUrlsTitle),
109127
onExpansionChanged: (isExpanded) {
110128
_expandedTileIndex.value = isExpanded ? tileIndex : null;
111129
},

0 commit comments

Comments
 (0)