Skip to content

Commit e1c9ec5

Browse files
committed
feat(app_configuration): reorganize update config form layout
- Move SwitchListTile to the top of the form - Add conditional rendering for latest version fields - Adjust padding and spacing for better visual hierarchy - Remove redundant description text for the configuration
1 parent e5d0cba commit e1c9ec5

File tree

1 file changed

+73
-68
lines changed

1 file changed

+73
-68
lines changed

lib/app_configuration/widgets/update_config_form.dart

Lines changed: 73 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -68,79 +68,84 @@ class _UpdateConfigFormState extends State<UpdateConfigForm> {
6868
final appConfig = widget.remoteConfig.app;
6969
final updateConfig = appConfig.update;
7070

71-
return Padding(
72-
padding: const EdgeInsets.all(AppSpacing.lg),
73-
child: Column(
74-
crossAxisAlignment: CrossAxisAlignment.start,
75-
children: [
76-
Text(
77-
l10n.updateConfigDescription,
78-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
79-
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
71+
return Column(
72+
crossAxisAlignment: CrossAxisAlignment.start,
73+
children: [
74+
SwitchListTile(
75+
title: Text(l10n.enableForcedUpdatesLabel),
76+
subtitle: Text(l10n.enableForcedUpdatesDescription),
77+
value: updateConfig.isLatestVersionOnly,
78+
onChanged: (value) {
79+
widget.onConfigChanged(
80+
widget.remoteConfig.copyWith(
81+
app: appConfig.copyWith(
82+
update: updateConfig.copyWith(isLatestVersionOnly: value),
83+
),
84+
),
85+
);
86+
},
87+
),
88+
if (updateConfig.isLatestVersionOnly)
89+
Padding(
90+
padding: const EdgeInsets.only(
91+
left: AppSpacing.lg,
92+
top: AppSpacing.md,
8093
),
81-
),
82-
const SizedBox(height: AppSpacing.lg),
83-
AppConfigTextField(
84-
label: l10n.latestAppVersionLabel,
85-
description: l10n.latestAppVersionDescription,
86-
value: updateConfig.latestAppVersion,
87-
onChanged: (value) {
88-
widget.onConfigChanged(
89-
widget.remoteConfig.copyWith(
90-
app: appConfig.copyWith(
91-
update: updateConfig.copyWith(latestAppVersion: value),
92-
),
94+
child: Column(
95+
children: [
96+
AppConfigTextField(
97+
label: l10n.latestAppVersionLabel,
98+
description: l10n.latestAppVersionDescription,
99+
value: updateConfig.latestAppVersion,
100+
onChanged: (value) {
101+
widget.onConfigChanged(
102+
widget.remoteConfig.copyWith(
103+
app: appConfig.copyWith(
104+
update: updateConfig.copyWith(
105+
latestAppVersion: value,
106+
),
107+
),
108+
),
109+
);
110+
},
111+
controller: _latestVersionController,
93112
),
94-
);
95-
},
96-
controller: _latestVersionController,
97-
),
98-
SwitchListTile(
99-
title: Text(l10n.isLatestVersionOnlyLabel),
100-
subtitle: Text(l10n.isLatestVersionOnlyDescription),
101-
value: updateConfig.isLatestVersionOnly,
102-
onChanged: (value) {
103-
widget.onConfigChanged(
104-
widget.remoteConfig.copyWith(
105-
app: appConfig.copyWith(
106-
update: updateConfig.copyWith(isLatestVersionOnly: value),
107-
),
113+
AppConfigTextField(
114+
label: l10n.iosUpdateUrlLabel,
115+
description: l10n.iosUpdateUrlDescription,
116+
value: updateConfig.iosUpdateUrl,
117+
onChanged: (value) {
118+
widget.onConfigChanged(
119+
widget.remoteConfig.copyWith(
120+
app: appConfig.copyWith(
121+
update: updateConfig.copyWith(iosUpdateUrl: value),
122+
),
123+
),
124+
);
125+
},
126+
controller: _iosUrlController,
108127
),
109-
);
110-
},
111-
),
112-
AppConfigTextField(
113-
label: l10n.iosUpdateUrlLabel,
114-
description: l10n.iosUpdateUrlDescription,
115-
value: updateConfig.iosUpdateUrl,
116-
onChanged: (value) {
117-
widget.onConfigChanged(
118-
widget.remoteConfig.copyWith(
119-
app: appConfig.copyWith(
120-
update: updateConfig.copyWith(iosUpdateUrl: value),
121-
),
128+
AppConfigTextField(
129+
label: l10n.androidUpdateUrlLabel,
130+
description: l10n.androidUpdateUrlDescription,
131+
value: updateConfig.androidUpdateUrl,
132+
onChanged: (value) {
133+
widget.onConfigChanged(
134+
widget.remoteConfig.copyWith(
135+
app: appConfig.copyWith(
136+
update: updateConfig.copyWith(
137+
androidUpdateUrl: value,
138+
),
139+
),
140+
),
141+
);
142+
},
143+
controller: _androidUrlController,
122144
),
123-
);
124-
},
125-
controller: _iosUrlController,
126-
),
127-
AppConfigTextField(
128-
label: l10n.androidUpdateUrlLabel,
129-
description: l10n.androidUpdateUrlDescription,
130-
value: updateConfig.androidUpdateUrl,
131-
onChanged: (value) {
132-
widget.onConfigChanged(
133-
widget.remoteConfig.copyWith(
134-
app: appConfig.copyWith(
135-
update: updateConfig.copyWith(androidUpdateUrl: value),
136-
),
137-
),
138-
);
139-
},
140-
controller: _androidUrlController,
145+
],
146+
),
141147
),
142-
],
143-
),
148+
],
144149
);
145150
}
146151
}

0 commit comments

Comments
 (0)