diff --git a/lib/settings_page.dart b/lib/settings_page.dart index 073ccea2..765aa1a2 100755 --- a/lib/settings_page.dart +++ b/lib/settings_page.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:logging/logging.dart'; -import 'package:yubico_authenticator/app/logging.dart'; +import 'app/logging.dart'; import 'app/state.dart'; +import 'widgets/list_title.dart'; import 'widgets/responsive_dialog.dart'; final _log = Logger('settings'); @@ -13,22 +14,36 @@ class SettingsPage extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final themeMode = ref.watch(themeModeProvider); return ResponsiveDialog( title: const Text('Settings'), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - DropdownButtonFormField( - decoration: const InputDecoration(labelText: 'Theme'), - value: ref.watch(themeModeProvider), - items: [ThemeMode.system, ThemeMode.dark, ThemeMode.light] - .map((e) => DropdownMenuItem( - value: e, - child: - Text(e.name[0].toUpperCase() + e.name.substring(1)), - )) - .toList(), + const ListTitle('Appearance'), + RadioListTile( + title: const Text('System default'), + value: ThemeMode.system, + groupValue: themeMode, + onChanged: (mode) { + ref.read(themeModeProvider.notifier).setThemeMode(mode!); + _log.debug('Set theme mode to $mode'); + }, + ), + RadioListTile( + title: const Text('Light mode'), + value: ThemeMode.light, + groupValue: themeMode, + onChanged: (mode) { + ref.read(themeModeProvider.notifier).setThemeMode(mode!); + _log.debug('Set theme mode to $mode'); + }, + ), + RadioListTile( + title: const Text('Dark mode'), + value: ThemeMode.dark, + groupValue: themeMode, onChanged: (mode) { ref.read(themeModeProvider.notifier).setThemeMode(mode!); _log.debug('Set theme mode to $mode');