Open JErazo7 opened 3 years ago
I was having this issue too, the only way I could solve was to use code generation and instead of loading the json file from assets I used the generated class.
did you guys face this issue for ios side, ? https://github.com/aissat/easy_localization/issues/381
A problem is when set backgroundColor: Colors.transparent,
its because preloader widget was been removed from 3.0.0 https://github.com/aissat/easy_localization/blob/develop/CHANGELOG.md#300
Add your own colored background widget or use your own solution
ColoredBox(
color: Colors.red,
child: EasyLocalization(
The blinking appears because the localization is loaded asynchronously and when it is not there, the app bg is shown(black)
I have same issue fixed as below, Here is my code,
Also I think the context.setLocale
doesn't have normal behavior inside of FutureBuilder
.
return FutureBuilder<bool>(
future: changeLocale(
context: context,
languageCode: languageCode,
),
builder: (context, snapshot) {
if (snapshot.data == null) {
return SafeArea(
child: Scaffold(
body: progressLoading(),
),
);
}
return SplashScreen();
},
);
.
Future<bool> changeLocale({
required BuildContext context,
required String languageCode,
}) async {
Future<bool> _setLocale() async {
await context.setLocale(
getLocaleByCountry(languageCode)!,
);
return true;
}
return await _setLocale();
}
Nice package but I can not use it because of this.
The problem as @Overman775 says its related to asyncronously locale load. Here is a good explanation about what is going on using flutter_intl https://github.com/Racinggavin/black_screen_inv (different but the same problem under the hood)
The solution I found was following exactly what it is described at the official flutter doc: https://flutter.dev/docs/development/accessibility-and-localization/internationalization However I loose lot of capabilities such as plurals etc.
The blinking appears because the localization is loaded asynchronously and when it is not there, the app bg is shown(black)
Is there any solution to show preloader widget? In previous version, this was available
The problem occurs when my JSON file becomes too large, as I delete at least 5 random keys and it works perfectly again.