From b715cf9535f31e87b31a7348eb2fc26295d44080 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 12 May 2023 15:05:40 -0600 Subject: [PATCH] fix: selected theme on deleting themes changing --- .../sub_widgets/theme_options_widget.dart | 11 ++++---- .../appearance_settings.dart | 25 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart index b5eb1ed16..de5c91ee0 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart @@ -92,11 +92,6 @@ class _ThemeOptionsWidgetState extends ConsumerState { .installedThemes .map((e) => Tuple2(e.themeId, e.name)) .toList(); - } - - @override - void initState() { - _updateInstalledList(); if (ref.read(prefsChangeNotifierProvider).enableSystemBrightness) { _current = installedThemeIdNames.length; @@ -110,6 +105,11 @@ class _ThemeOptionsWidgetState extends ConsumerState { } } } + } + + @override + void initState() { + _updateInstalledList(); _subscription = ref.read(mainDBProvider).isar.stackThemes.watchLazy().listen((_) { @@ -212,6 +212,7 @@ class _ThemeOptionsWidgetState extends ConsumerState { ), for (int i = 0; i < installedThemeIdNames.length; i++) ConditionalParent( + key: Key("installedTheme_${installedThemeIdNames[i].item1}"), condition: i > 0, builder: (child) => Padding( padding: const EdgeInsets.only(top: 10), diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart index 2cc79df71..4c500eaf7 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart @@ -272,18 +272,6 @@ class _ThemeToggle extends ConsumerState { .installedThemes .map((e) => Tuple3(e.themeId, e.name, e.assets.themeSelector)) .toList(); - } - - void _manageThemesPressed() { - showDialog( - context: context, - builder: (_) => const DesktopManageThemesDialog(), - ); - } - - @override - void initState() { - _updateInstalledList(); if (ref.read(prefsChangeNotifierProvider).enableSystemBrightness) { _current = installedThemeIdNames.length; @@ -297,6 +285,18 @@ class _ThemeToggle extends ConsumerState { } } } + } + + void _manageThemesPressed() { + showDialog( + context: context, + builder: (_) => const DesktopManageThemesDialog(), + ); + } + + @override + void initState() { + _updateInstalledList(); _subscription = ref.read(mainDBProvider).isar.stackThemes.watchLazy().listen((_) { @@ -326,6 +326,7 @@ class _ThemeToggle extends ConsumerState { children: [ for (int i = 0; i < installedThemeIdNames.length; i++) Padding( + key: Key("installedTheme_${installedThemeIdNames[i].item1}"), padding: const EdgeInsets.all(8.0), child: MouseRegion( cursor: SystemMouseCursors.click,