1、添加依赖
在pubspec.yaml依赖中添加
flutter_localizations:
sdk: flutter
2、引用
import 'package:flutter_localizations/flutter_localizations.dart';
3、配置
locale:Locale('en','US'),
localizationsDelegates:[
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales:[
Locale('en','US'),
Locale('zh','CN'),
],
网友评论