there is a noticable lug on app startup after implementing this package.
at least it would be nice to provide a splash screen feature. like https://pub.dev/packages/animated_splash
yes, me too.
This happen during load in the delegate
EasylocaLizationDelegate
class EasylocaLizationDelegate extends LocalizationsDelegate<AppLocalizations> {
final Locale locale;
final String path;
final String loadPath;
/// * use only the lang code to generate i18n file path like en.json or ar.json
final bool useOnlyLangCode;
EasylocaLizationDelegate({
@required this.locale,
this.path,
this.loadPath,
this.useOnlyLangCode = false,
});
@override
bool isSupported(Locale locale) => locale != null;
@override
Future<AppLocalizations> load(Locale value) async {
final SharedPreferences _preferences =
await SharedPreferences.getInstance();
var _codeLang = _preferences.getString('codeL');
var _codeCoun = _preferences.getString('codeC');
if (_codeLang == null || _codeCoun == null) {
//value = Locale(this.locale.languageCode, this.locale.countryCode);
await _preferences.setString('codeC', value.countryCode);
await _preferences.setString('codeL', value.languageCode);
} else
value = Locale(_codeLang, _codeCoun);
AppLocalizations localizations = AppLocalizations(value,
path: path, loadPath: loadPath, useOnlyLangCode: useOnlyLangCode);
await localizations.load();
return localizations;
}
@override
bool shouldReload(LocalizationsDelegate<AppLocalizations> old) => true;
}
It would be useful to load delegate before the runApp method so the app would stay in its splash screen
Same issue but I resolved it now, Because I forgot add asset in pubspec.yaml
assets:
Hope this can help you.
The one thing can make your app to black screen is "EasyLocalizationProvider", You need to wrap everything with it like this.
Widget build(BuildContext context) {
var data = EasyLocalizationProvider.of(context).data;
data.changeLocale(Locale("th","TH"));
return EasyLocalizationProvider(
data: data,
child: MaterialApp(
...
...
anyone has solution for this?