Skip to content

Commit

Permalink
fix: multiple instance of theme
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Jun 10, 2023
1 parent bf04962 commit 4ec0424
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ class SpotubeState extends ConsumerState<Spotube> {
};
}, []);

final lightTheme = useMemoized(
() => theme(paletteColor ?? accentMaterialColor, Brightness.light),
[paletteColor, accentMaterialColor],
);
final darkTheme = useMemoized(
() => theme(paletteColor ?? accentMaterialColor, Brightness.dark),
[paletteColor, accentMaterialColor],
);

return MaterialApp.router(
supportedLocales: L10n.all,
locale: locale.languageCode == "system" ? null : locale,
Expand All @@ -216,8 +225,8 @@ class SpotubeState extends ConsumerState<Spotube> {
);
},
themeMode: themeMode,
theme: theme(paletteColor ?? accentMaterialColor, Brightness.light),
darkTheme: theme(paletteColor ?? accentMaterialColor, Brightness.dark),
theme: lightTheme,
darkTheme: darkTheme,
shortcuts: {
...WidgetsApp.defaultShortcuts.map((key, value) {
return MapEntry(
Expand Down

0 comments on commit 4ec0424

Please sign in to comment.