Restyle settings page.

This commit is contained in:
Dain Nilsson 2022-06-02 15:49:52 +02:00
parent 1ed3ee27c3
commit b8a7276313
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -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');