Moved theme selector into dialog
FIXES: Bug where text would wrap after a couple of characters on mobile, because flutter keeps the SegmentedButton at full width
This commit is contained in:
parent
30a19fcc1e
commit
67a5130ac0
1 changed files with 44 additions and 21 deletions
|
@ -112,8 +112,20 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||||
title: const Text('Change Theme'),
|
title: const Text('Change Theme'),
|
||||||
subtitle: const Text(
|
subtitle: const Text(
|
||||||
'You can change between a light theme, a dark theme and automatic theme selection'),
|
'You can change between a light theme, a dark theme and automatic theme selection'),
|
||||||
// NOTE: have the trailing item be a value select widget
|
trailing: const Icon(Icons.chevron_right),
|
||||||
trailing: SegmentedButton<AppTheme>(
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('Change Theme'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
child: Text('Choose your preferred theme'),
|
||||||
|
),
|
||||||
|
SegmentedButton<AppTheme>(
|
||||||
selected: {context.watch<AppTheme>()},
|
selected: {context.watch<AppTheme>()},
|
||||||
selectedIcon: Icon(context.watch<AppTheme>().icon),
|
selectedIcon: Icon(context.watch<AppTheme>().icon),
|
||||||
showSelectedIcon: true,
|
showSelectedIcon: true,
|
||||||
|
@ -121,7 +133,9 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||||
emptySelectionAllowed: false,
|
emptySelectionAllowed: false,
|
||||||
segments: AppTheme.list().map((item) {
|
segments: AppTheme.list().map((item) {
|
||||||
return ButtonSegment<AppTheme>(
|
return ButtonSegment<AppTheme>(
|
||||||
value: item, icon: Icon(item.icon), label: Text(item.name));
|
value: item,
|
||||||
|
icon: Icon(item.icon),
|
||||||
|
label: Text(item.name));
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onSelectionChanged: (item) async {
|
onSelectionChanged: (item) async {
|
||||||
try {
|
try {
|
||||||
|
@ -129,6 +143,19 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
FilledButton(
|
||||||
|
child: const Text('Close'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
// change password button
|
// change password button
|
||||||
|
@ -136,10 +163,6 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||||
title: const Text('Change password'),
|
title: const Text('Change password'),
|
||||||
subtitle: const Text('Choose a new password for your account'),
|
subtitle: const Text('Choose a new password for your account'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// TODO: show confirm dialog
|
|
||||||
// NOTE: needs an input field for the current password
|
|
||||||
// NOTE: might want to show a message explaining,
|
|
||||||
// that there is no way to reset the password
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => const ChangePasswordDialog());
|
builder: (context) => const ChangePasswordDialog());
|
||||||
|
|
Loading…
Reference in a new issue