@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
22import 'package:flutter_riverpod/flutter_riverpod.dart' ;
33import 'package:open_authenticator/i18n/translations.g.dart' ;
44import 'package:open_authenticator/model/settings/theme.dart' ;
5- import 'package:open_authenticator/widgets/form/dropdown_list_tile.dart' ;
65
76/// Allows to configure [themeSettingsEntryProvider] .
87class ThemeSettingsEntryWidget extends ConsumerWidget {
@@ -14,23 +13,54 @@ class ThemeSettingsEntryWidget extends ConsumerWidget {
1413 @override
1514 Widget build (BuildContext context, WidgetRef ref) {
1615 AsyncValue <ThemeMode > theme = ref.watch (themeSettingsEntryProvider);
17- return DropdownListTile (
16+ return ListTile (
1817 enabled: theme.hasValue,
1918 title: Text (translations.settings.application.theme.title),
20- value: theme.value,
21- choices: [
22- for (ThemeMode mode in ThemeMode .values)
23- DropdownListTileChoice (
24- title: translations.settings.application.theme.values[mode.name]! ,
25- icon: mode.icon,
26- value: mode,
19+ subtitle: Text (translations.settings.application.theme.subtitle),
20+ leading: Icon (theme.value? .icon),
21+ trailing: const Padding (
22+ padding: EdgeInsets .symmetric (horizontal: 10 ),
23+ child: Icon (Icons .chevron_right),
24+ ),
25+ onTap: () {
26+ Navigator .push (
27+ context,
28+ MaterialPageRoute (
29+ builder: (context) => _ThemeRouteWidget (),
2730 ),
28- ],
29- onChoiceSelected : (choice) => ref. read (themeSettingsEntryProvider.notifier). changeValue (choice.value) ,
31+ );
32+ } ,
3033 );
3134 }
3235}
3336
37+ /// Allows to configure the theme.
38+ class _ThemeRouteWidget extends ConsumerWidget {
39+ @override
40+ Widget build (BuildContext context, WidgetRef ref) {
41+ AsyncValue <ThemeMode > theme = ref.watch (themeSettingsEntryProvider);
42+ return Scaffold (
43+ appBar: AppBar (
44+ title: Text (translations.settings.application.theme.title),
45+ ),
46+ body: ListView (
47+ shrinkWrap: true ,
48+ children: [
49+ for (ThemeMode mode in ThemeMode .values)
50+ ListTile (
51+ leading: Icon (mode.icon),
52+ title: Text (translations.settings.application.theme.name[mode.name]! ),
53+ subtitle: Text (translations.settings.application.theme.description[mode.name]! ),
54+ trailing: theme.value == mode ? const Icon (Icons .check) : null ,
55+ onTap: () => ref.read (themeSettingsEntryProvider.notifier).changeValue (mode),
56+ ),
57+ ],
58+ ),
59+ );
60+ }
61+
62+ }
63+
3464/// Allows to associate an icon with a theme mode.
3565extension _Icon on ThemeMode ? {
3666 /// Returns the icon associated with the current theme mode.
0 commit comments