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'),
网友评论