【发布时间】:2019-11-07 16:08:32
【问题描述】:
我想使用GlobalMaterialLocalizations class 中可用的预定义本地化字符串之一。我已将必要的点点滴滴添加到我的MaterialApp
MaterialApp(
localizationsDelegates: [
const LocalizationDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('en', ''),
const Locale('sv', ''),
],
localeResolutionCallback:(Locale locale, Iterable<Locale> supportedLocales) {
return locale; // Return a different locale if the user choose another language in the settings
},
...
我的自定义 LocalizationDelegate 工作正常。我只是不知道如何使用GlobalMaterialLocalizations 中的预定义字符串,因为没有GlobalMaterialLocalizations.of(BuildContext) 方法?
【问题讨论】:
标签: flutter localization material-design flutter-layout