mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-23 00:57:26 +03:00
Restyle settings page.
This commit is contained in:
parent
1ed3ee27c3
commit
b8a7276313
@ -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<ThemeMode>(
|
||||
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<ThemeMode>(
|
||||
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<ThemeMode>(
|
||||
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<ThemeMode>(
|
||||
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');
|
||||
|
Loading…
Reference in New Issue
Block a user