You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return MaterialApp.router(
routerDelegate: router.routerDelegate,
routeInformationParser: router.routeInformationParser,
routeInformationProvider: router.routeInformationProvider,
debugShowCheckedModeBanner: false,
restorationScopeId: 'app',
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale, // works in my app, but not in device preview
locale: DevicePreview.locale(context), // does not work in my app, works poorly in device preview
theme: lightThemeData,
darkTheme: darkThemeData,
themeMode: context.watch<ThemeChangeNotifier>().themeMode,
builder: DevicePreview.appBuilder,
);
My flutter doctor summary
[✓] Flutter (Channel stable, 3.27.4, on macOS 15.2 24C101 darwin-arm64,
locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version
34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.97.2)
[✓] Connected device (3 available)
[✓] Network resources
What I would like is to set 'locale: DevicePreview.locale(context)' once, and have locale switching continue to work normally from both my app ui and from the device preview console.
The text was updated successfully, but these errors were encountered:
Dan1ell
changed the title
DevicePreview locale not working with easy localization
DevicePreview locale not working well with easy localization
Feb 14, 2025
Dan1ell
changed the title
DevicePreview locale not working well with easy localization
DevicePreview locale not working well with easy_localization
Feb 14, 2025
I'm using EasyLocalization (and GoRouter, in case it is relevant).
EasyLocalization requires: locale: context.locale,
DevicePreview requires: locale: DevicePreview.locale(context),
When setting the line to what DevicePreview needs, locale switching becomes unreliable. In particular:
Any lines of code in the app that reference context.locale become non-functional. e.g.:
My main.dart
My app.dart
My flutter doctor summary
What I would like is to set 'locale: DevicePreview.locale(context)' once, and have locale switching continue to work normally from both my app ui and from the device preview console.
The text was updated successfully, but these errors were encountered: