Closed mironsaid closed 1 year ago
main.dart
void main() async { var localizationsDelegate = await LocalizationDelegate.create( fallbackLocale: 'en_US', supportedLocales: [ 'en_US', 'ar', 'ku', ], ); runApp( LocalizedApp( localizationsDelegate, MainApp(), ), ); } class MainApp extends StatelessWidget { const MainApp({super.key}); @override Widget build(BuildContext context) { var localizationDelegate = LocalizedApp.of(context).delegate; return LocalizationProvider( state: LocalizationProvider.of(context).state, child: ScreenUtilInit( designSize: const Size(990, 769), minTextAdapt: true, splitScreenMode: false, builder: (context, child) => MaterialApp( debugShowCheckedModeBanner: false, navigatorKey: NavigationService.navigatorKey, routes: Routes.routes, initialRoute: '/', theme: theme, localizationsDelegates: [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, localizationDelegate, ], supportedLocales: localizationDelegate.supportedLocales, ), ), ); } }
routes.dart
class Routes { static const String HOMESCREEN = '/'; static Map<String, Widget Function(BuildContext)> routes = { HOMESCREEN: (context) { return const HomeScreen(); }, };
I am performing the locale change in a dialog. When the locale change occurs, the locale changes to the selected language but then reverts back to the original locale.
main.dart
routes.dart
I am performing the locale change in a dialog. When the locale change occurs, the locale changes to the selected language but then reverts back to the original locale.