flutter 多语言配置—中文—转

flutter 多语言配置—中文

dependencies:
  flutter:
    sdk: flutter
    #国际化支持
  flutter_localizations:
    sdk: flutter
List an = [
  const Locale('zh', 'CH'),
  const Locale('en', 'US'),
];
List 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'),

你可能感兴趣的:(flutter 多语言配置—中文—转)