美文网首页
flutter 多语言配置—中文—转

flutter 多语言配置—中文—转

作者: 王保全_1098 | 来源:发表于2019-03-18 23:22 被阅读0次

    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'),
    

    相关文章

      网友评论

          本文标题:flutter 多语言配置—中文—转

          本文链接:https://www.haomeiwen.com/subject/vboimqtx.html