showAboutDialog 的 Flutter 和翻译按钮

Flutter and translated buttons for showAboutDialog

我有一个按钮可以显示有关我的应用程序的信息,它运行良好:

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,
                    ),
                  ],
                );
              },

问题是 "View licenses" 和 "Close" 按钮没有实时翻译。我需要刷新整个应用程序来翻译它们: (检查语言是否已更新但按钮仍然不是英文)

这是改变语言的代码:

 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);
                },

showAboutDialog() 方法将始终以系统语言显示两个按钮(对您来说似乎是西班牙语)。如果你想要不同的行为,你将不得不开发一个自定义对话框