Skip to content

Instantly share code, notes, and snippets.

@guilhermecarvalhocarneiro
Created April 19, 2021 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilhermecarvalhocarneiro/76f8faaece198c03a79fb8990406b078 to your computer and use it in GitHub Desktop.
Save guilhermecarvalhocarneiro/76f8faaece198c03a79fb8990406b078 to your computer and use it in GitHub Desktop.
...
return MaterialApp(
title: Config.app_title,
theme: context.watch<SettingsCubit>().lightTheme == true ? CustomTheme.lightTheme : CustomTheme.darkTheme,
home: MyHomePage(title: '${Config.app_title}'),
onGenerateRoute: RouteGenerator.generateRoute,
supportedLocales: [
const Locale('en', 'US'),
const Locale('pt', 'BR'),
],
localizationsDelegates: [
AppLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
localeResolutionCallback: (locale, supportedLocales) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode &&
supportedLocale.countryCode == locale.countryCode) {
currentLanguage = supportedLocale.toString();
return supportedLocale;
}
}
return supportedLocales.first;
},
debugShowCheckedModeBanner: false,
);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment