diff --git a/lib/app.dart b/lib/app.dart index 0c2756f..7c8ffcb 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -17,7 +17,12 @@ class MyApp extends StatelessWidget { home: Home(), localeResolutionCallback: (Locale locale, Iterable supportedLocales) { - return locale; + for (final supportedLocale in supportedLocales) { + if (locale.languageCode == supportedLocale.languageCode) { + return supportedLocale; + } + } + return supportedLocales.first; }, localizationsDelegates: [ S.delegate, @@ -47,7 +52,12 @@ class MyApp extends StatelessWidget { home: Home(), localeResolutionCallback: (Locale locale, Iterable supportedLocales) { - return locale; + for (final supportedLocale in supportedLocales) { + if (locale.languageCode == supportedLocale.languageCode) { + return supportedLocale; + } + } + return supportedLocales.first; }, localizationsDelegates: [ S.delegate,