你好,我正在尝试添加BottomNavigationBar在Flutter应用程序,但当我运行项目错误occures:
A MaterialLocalizations delegate that supports the ka_GE locale was not found
字符串
这是我的APP委托:
supportedLocales: [
const Locale('en', 'US'),
const Locale('ka', 'GE'),
const Locale('ru', 'RU'),
],
localizationsDelegates: [
const InfosLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
locale: Locale('ka')
型
这是Custom LocalizationsDelegate:
class CLocalizationsDelegate
extends LocalizationsDelegate<CLocalizations> {
const CLocalizationsDelegate();
@override
bool isSupported(Locale locale) =>
['en', 'ka', 'ru'].contains(locale.languageCode);
@override
Future<CLocalizations> load(Locale locale) async {
CLocalizations localizations = new CLocalizations(locale);
await localizations.load();
print("Load ${locale.languageCode}");
return localizations;
}
@override
bool shouldReload(CLocalizationsDelegate old) => false;
}
型
是的,我知道问题是'ka',因为MaterialLocalizations不支持它,但我必须解决这个问题,所以伙计们,你们能帮我吗?
2条答案
按热度按时间ldioqlga1#
添加 * GlobalCupertino Localizations * 到localizationsDelegates也可以解决问题。
字符串
2skhul332#
您可以实现自定义
MaterialLocalizations
委托字符串