flutter 多语言配置—中文—转

2019-03-18  本文已影响0人  王保全_1098

flutter 多语言配置—中文

dependencies:
  flutter:
    sdk: flutter
    #国际化支持
  flutter_localizations:
    sdk: flutter
List<Locale> an = [
  const Locale('zh', 'CH'),
  const Locale('en', 'US'),
];
List<Locale> ios = [
  const Locale('en', 'US'),
  const Locale('zh', 'CH'),
];
void main() {
  runApp(MaterialApp(
    title: '中油北斗',
    theme: new ThemeData(
      platform: TargetPlatform.iOS, // 该属性可使页面右划返回
    ),
    home: SplashScreen(),
    // 国际化支持
    localizationsDelegates: [
      GlobalMaterialLocalizations.delegate,
      GlobalWidgetsLocalizations.delegate,
      ChineseCupertinoLocalizations.delegate,
    ],
    supportedLocales: Platform.isIOS ? ios : an,
    locale: Locale('zh'),
上一篇 下一篇

猜你喜欢

热点阅读