Created
March 19, 2020 05:35
-
-
Save tianhaoz95/43df1ee4930a9d4af79d1e2cd2a6f55f to your computer and use it in GitHub Desktop.
example app with i18n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PhotoChatApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return ChangeNotifierProvider<AppContext>( | |
| create: (context) => | |
| AppContext(appRunningStateOverride: this.appRunningState), | |
| child: MaterialApp( | |
| title: 'Mini Donkey', | |
| localizationsDelegates: [ | |
| AppLocalizationsDelegate(), | |
| GlobalMaterialLocalizations.delegate, | |
| GlobalWidgetsLocalizations.delegate, | |
| GlobalCupertinoLocalizations.delegate, | |
| ], | |
| localeResolutionCallback: | |
| (Locale locale, Iterable<Locale> supportedLocales) { | |
| print('checking ' + locale.toString()); | |
| return locale; | |
| }, | |
| supportedLocales: [ | |
| const Locale('en'), | |
| const Locale.fromSubtags(languageCode: 'zh'), | |
| ], | |
| )); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment