-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screen flashes black while loading delegate #13
Comments
Quick update on this. I just built the app I'm working on in release mode on my physical device and I'm not experiencing this issue! It definitely is noticeable in the emulator and not there without this package, but as far as I'm concerned since it works perfectly in release mode this issue might be able to be closed. I haven't tested the example app yet on my device, but I'm sure it works the same. |
This is definitely an issue, I could reproduce it on the emulator and from what I can see there are some other open issues (such as flutter/flutter#22007 and flutter/flutter#20827) regarding this behavior. In our case here, it seems the problem is the localization initialization by Flutter, which happens right after the splash screen is closed and before the main (app) widget is rendered. If we force the localization initialization before runApp (by calling Ex: void main() async
{
WidgetsFlutterBinding.ensureInitialized();
var delegate = await LocalizationDelegate.create(fallbackLocale: 'en_US',supportedLocales: ['en_US', 'es', 'fa']);
delegate.changeLocale(Locale('en_US'));
runApp(LocalizedApp(delegate, MyApp()));
} The problem with this is that on first startup, the current device locale should be used (if supported by the application). So I think the solution here, in order to have the default locale used on startup and not to have this black screen behavior, is to retrieve the current device locale and initialize it before runApp, instead of letting Flutter decide when to initialize it. This could be implemented directly in the |
Thanks for the update on this! I'm going to look into implementing that if you haven't already gotten to it before I do. |
The screen flashes black when loading the delegate. I've looked into this issue, but don't think it is related.
This can be replicated by running the example app and noticing the color flash between the splash image ending and the main app content loading.
Any idea on how to resolve this? I've been looking into it for a while now.
The text was updated successfully, but these errors were encountered: