fix: selected theme on deleting themes changing

This commit is contained in:
julian 2023-05-12 15:05:40 -06:00
parent 147914f650
commit b715cf9535
2 changed files with 19 additions and 17 deletions

View file

@ -92,11 +92,6 @@ class _ThemeOptionsWidgetState extends ConsumerState<ThemeOptionsWidget> {
.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<ThemeOptionsWidget> {
}
}
}
}
@override
void initState() {
_updateInstalledList();
_subscription =
ref.read(mainDBProvider).isar.stackThemes.watchLazy().listen((_) {
@ -212,6 +212,7 @@ class _ThemeOptionsWidgetState extends ConsumerState<ThemeOptionsWidget> {
),
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),

View file

@ -272,18 +272,6 @@ class _ThemeToggle extends ConsumerState<ThemeToggle> {
.installedThemes
.map((e) => Tuple3(e.themeId, e.name, e.assets.themeSelector))
.toList();
}
void _manageThemesPressed() {
showDialog<void>(
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<ThemeToggle> {
}
}
}
}
void _manageThemesPressed() {
showDialog<void>(
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<ThemeToggle> {
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,