refactor: replace HookConsumerWidget with ConsumerWidget and add ThemeModePrefTile
This commit is contained in:
@@ -19,39 +19,10 @@ class GeneralSettingTiles extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final t = ref.watch(translationsProvider);
|
||||
|
||||
final themeMode = ref.watch(themePreferencesProvider);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
const LocalePrefTile(),
|
||||
ListTile(
|
||||
title: Text(t.settings.general.themeMode),
|
||||
subtitle: Text(themeMode.present(t)),
|
||||
leading: const Icon(FluentIcons.weather_moon_20_regular),
|
||||
onTap: () async {
|
||||
final selectedThemeMode = await showDialog<AppThemeMode>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SimpleDialog(
|
||||
title: Text(t.settings.general.themeMode),
|
||||
children: AppThemeMode.values
|
||||
.map(
|
||||
(e) => RadioListTile(
|
||||
title: Text(e.present(t)),
|
||||
value: e,
|
||||
groupValue: themeMode,
|
||||
onChanged: Navigator.of(context).maybePop,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
if (selectedThemeMode != null) {
|
||||
await ref.read(themePreferencesProvider.notifier).changeThemeMode(selectedThemeMode);
|
||||
}
|
||||
},
|
||||
),
|
||||
const ThemeModePrefTile(),
|
||||
const EnableAnalyticsPrefTile(),
|
||||
SwitchListTile(
|
||||
title: Text(t.settings.general.autoIpCheck),
|
||||
|
||||
Reference in New Issue
Block a user