Skip to content

Commit

Permalink
Broken locale and theme switching fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kern, Thomas committed Dec 30, 2023
1 parent 2da9871 commit 9d999f3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,21 @@ void main() {
}

class AppWidget extends StatelessWidget {
final theme = Globals.preferences.theme;
final themeChanged = Globals.preferences.themeChanged;
final preferences = Globals.preferences;
final router = Globals.applicationRoutes.router;
final appLocale = Globals.preferences.appLocale;

AppWidget({super.key});

@override
Widget build(BuildContext context) {
return ValueListenableBuilder<AppTheme>(
valueListenable: themeChanged,
valueListenable: preferences.themeChanged,
builder: (_, themeData, __) {
return MaterialApp.router(
debugShowCheckedModeBanner: false,
scaffoldMessengerKey: Globals.rootScaffoldMessengerKey,
title: 'Mopicon',
theme: theme.data,
theme: preferences.theme.data,
routerConfig: router,
localizationsDelegates: const [
S.delegate,
Expand All @@ -60,7 +58,7 @@ class AppWidget extends StatelessWidget {
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
locale: appLocale.locale,
locale: preferences.appLocale.locale,
);
});
}
Expand Down

0 comments on commit 9d999f3

Please sign in to comment.