Skip to content

Commit f5f9485

Browse files
committed
refactor(settings): Remove isExpanded from dropdowns
- Improve UI layout - Fix dropdown width issues
1 parent 07cbc45 commit f5f9485

File tree

1 file changed

+51
-58
lines changed

1 file changed

+51
-58
lines changed

lib/settings/view/settings_page.dart

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -159,29 +159,25 @@ class _SettingsView extends StatelessWidget {
159159
children: [
160160
ExpansionTile(
161161
title: Text(l10n.themeSettingsLabel),
162-
childrenPadding:
163-
const EdgeInsets.symmetric(
164-
horizontal: AppSpacing.xxl,
165-
),
162+
childrenPadding: const EdgeInsets.symmetric(
163+
horizontal: AppSpacing.xxl,
164+
),
166165
children: [
167166
_buildSettingSection(
168167
context,
169168
title: l10n.baseThemeLabel,
170-
description:
171-
l10n.baseThemeDescription,
169+
description: l10n.baseThemeDescription,
172170
child: DropdownButton<AppBaseTheme>(
173171
value: userAppSettings
174172
.displaySettings
175173
.baseTheme,
176174
onChanged: (value) {
177175
if (value != null) {
178-
context
179-
.read<SettingsBloc>()
180-
.add(
181-
SettingsBaseThemeChanged(
182-
value,
183-
),
184-
);
176+
context.read<SettingsBloc>().add(
177+
SettingsBaseThemeChanged(
178+
value,
179+
),
180+
);
185181
}
186182
},
187183
items: AppBaseTheme.values
@@ -197,7 +193,7 @@ class _SettingsView extends StatelessWidget {
197193
),
198194
)
199195
.toList(),
200-
isExpanded: true,
196+
// Removed isExpanded: true
201197
),
202198
),
203199
const SizedBox(height: AppSpacing.lg),
@@ -232,36 +228,32 @@ class _SettingsView extends StatelessWidget {
232228
),
233229
)
234230
.toList(),
235-
isExpanded: true,
231+
// Removed isExpanded: true
236232
),
237233
),
238234
],
239235
),
240236
ExpansionTile(
241237
title: Text(l10n.fontSettingsLabel),
242-
childrenPadding:
243-
const EdgeInsets.symmetric(
244-
horizontal: AppSpacing.xxl,
245-
),
238+
childrenPadding: const EdgeInsets.symmetric(
239+
horizontal: AppSpacing.xxl,
240+
),
246241
children: [
247242
_buildSettingSection(
248243
context,
249244
title: l10n.fontFamilyLabel,
250-
description:
251-
l10n.fontFamilyDescription,
245+
description: l10n.fontFamilyDescription,
252246
child: DropdownButton<String>(
253247
value: userAppSettings
254248
.displaySettings
255249
.fontFamily,
256250
onChanged: (value) {
257251
if (value != null) {
258-
context
259-
.read<SettingsBloc>()
260-
.add(
261-
SettingsFontFamilyChanged(
262-
value,
263-
),
264-
);
252+
context.read<SettingsBloc>().add(
253+
SettingsFontFamilyChanged(
254+
value,
255+
),
256+
);
265257
}
266258
},
267259
items: _supportedFontFamilies
@@ -277,7 +269,7 @@ class _SettingsView extends StatelessWidget {
277269
),
278270
)
279271
.toList(),
280-
isExpanded: true,
272+
// Removed isExpanded: true
281273
),
282274
),
283275
const SizedBox(height: AppSpacing.lg),
@@ -312,28 +304,25 @@ class _SettingsView extends StatelessWidget {
312304
),
313305
)
314306
.toList(),
315-
isExpanded: true,
307+
// Removed isExpanded: true
316308
),
317309
),
318310
const SizedBox(height: AppSpacing.lg),
319311
_buildSettingSection(
320312
context,
321313
title: l10n.fontWeightLabel,
322-
description:
323-
l10n.fontWeightDescription,
314+
description: l10n.fontWeightDescription,
324315
child: DropdownButton<AppFontWeight>(
325316
value: userAppSettings
326317
.displaySettings
327318
.fontWeight,
328319
onChanged: (value) {
329320
if (value != null) {
330-
context
331-
.read<SettingsBloc>()
332-
.add(
333-
SettingsFontWeightChanged(
334-
value,
335-
),
336-
);
321+
context.read<SettingsBloc>().add(
322+
SettingsFontWeightChanged(
323+
value,
324+
),
325+
);
337326
}
338327
},
339328
items: AppFontWeight.values
@@ -349,7 +338,7 @@ class _SettingsView extends StatelessWidget {
349338
),
350339
)
351340
.toList(),
352-
isExpanded: true,
341+
// Removed isExpanded: true
353342
),
354343
),
355344
],
@@ -384,9 +373,8 @@ class _SettingsView extends StatelessWidget {
384373
_getLanguageName(lang, l10n),
385374
),
386375
),
387-
)
388-
.toList(),
389-
isExpanded: true,
376+
).toList(),
377+
// Removed isExpanded: true
390378
),
391379
),
392380
],
@@ -411,25 +399,30 @@ class _SettingsView extends StatelessWidget {
411399
required String description,
412400
required Widget child,
413401
}) {
414-
return Column(
402+
return Row(
415403
crossAxisAlignment: CrossAxisAlignment.start,
404+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
416405
children: [
417-
Text(
418-
title,
419-
style: Theme.of(context).textTheme.titleMedium,
420-
),
421-
const SizedBox(height: AppSpacing.xs),
422-
Text(
423-
description,
424-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
425-
color: Theme.of(context).colorScheme.onSurfaceVariant,
406+
Expanded(
407+
child: Column(
408+
crossAxisAlignment: CrossAxisAlignment.start,
409+
children: [
410+
Text(
411+
title,
412+
style: Theme.of(context).textTheme.titleMedium,
413+
),
414+
const SizedBox(height: AppSpacing.xs),
415+
Text(
416+
description,
417+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
418+
color: Theme.of(context).colorScheme.onSurfaceVariant,
419+
),
420+
),
421+
],
426422
),
427423
),
428-
const SizedBox(height: AppSpacing.sm),
429-
Align(
430-
alignment: Alignment.centerLeft,
431-
child: child,
432-
),
424+
const SizedBox(width: AppSpacing.lg), // Add some spacing between text and dropdown
425+
child,
433426
],
434427
);
435428
}

0 commit comments

Comments
 (0)