【发布时间】:2020-06-06 14:59:40
【问题描述】:
我有一个按钮可以显示有关我的应用的信息,该应用运行良好:
onTap: () async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return showAboutDialog(
context: context,
applicationName: translate('title'),
applicationVersion: packageInfo.version,
children: [
Image(
image: AssetImage('assets/images/brand/icon.jpg'),
height: 100,
),
],
);
},
问题是“查看许可证”和“关闭”按钮不是实时翻译的。我需要刷新整个应用程序才能翻译它们: (检查语言是否已更新,但按钮仍然不是英文)
这是改变语言的代码:
onChanged: (String newLang) async {
// update dropdown language
_language = newLang;
// update app language
changeLocale(context, newLang);
// save language
final options = json.decode(_prefs.get('options'));
options["language"] = newLang;
_prefs.setString('options', json.encode(options));
Provider.of<MyRents>(context, listen: false)
.updateLanguage(newLang);
},
【问题讨论】:
标签: flutter flutter-dependencies