Skip to content
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

Black screen problem when opening the app. #96

Closed
hkndzdr opened this issue Mar 19, 2020 · 29 comments · Fixed by #116
Closed

Black screen problem when opening the app. #96

hkndzdr opened this issue Mar 19, 2020 · 29 comments · Fixed by #116

Comments

@hkndzdr
Copy link

hkndzdr commented Mar 19, 2020

Using the sample application in the repo, I recorded a video showing the error in both the emulator and the real device. You can see the obvious error in the emulator. It happens very fast on the real device. You can see 16,22 and 26 seconds in the video by watching at a speed of 0.25. Occurs when getting locale values from shared preferences. I have the same problem in my own applications where installed the this plugin. An extremely frustrating situation.

https://www.youtube.com/watch?v=idAvuFG6BmI

@aissat
Copy link
Owner

aissat commented Mar 20, 2020

@hkndzdr u mean this #74 and about black screen check this flutter/flutter#47582

@hkndzdr
Copy link
Author

hkndzdr commented Mar 20, 2020

There is no such problem in the flutter default sample application. There is no problem in any application where I don't integrate the Easy_localization plug-in. If I remove the plug-in from the application, the problem is resolved. Trying what is written here (flutter/flutter#47582) isn't a solution for me. I also tried all of them one by one.

@AlaaEldeenYsr
Copy link

AlaaEldeenYsr commented Mar 22, 2020

Screenshot from the EasyLocalizationState class
image

If you wrapped the EasyLocalization top level Widget with another Container Widget its color white you will see white screen instead of black screen, The problem as you see in the screenshot is that the FutureBuilder Widget returns a Container Widget represents the top level Widget of your app and that Container has a transparent background color as default so what appears until the easy localization FutureBuilder get completed is a transparent Container no thing above it and no thing in flutter means black.

Try what i have done here and your problem is solved.
image

So @aissat that Container in the FutureBuilder shouldn't be hard codded like that, It should be handled with a parameter like that.
image

@hkndzdr
Copy link
Author

hkndzdr commented Mar 22, 2020

Screenshot from the EasyLocalizationState class
image

If you wrapped the EasyLocalization top level Widget with another Container Widget its color white you will see white screen instead of black screen, The problem as you see in the screenshot is that the FutureBuilder Widget returns a Container Widget represents the top level Widget of your app and that Container has a transparent background color as default so what appears until the easy localization FutureBuilder get completed is a transparent Container no thing above it and no thing in flutter means black.

Try what i have done here and your problem is solved.
image

So @aissat that Container in the FutureBuilder shouldn't be hard codded like that, It should be handled with a parameter like that.
image

Thanks for your descriptive answer. An effective method as a workaround. I have not insisted in vain that this problem is not something special to me. In the issues that have already been closed (#26, # 40), the same problem has been raised by different users.

Your suggestion for the solution is quite logical. Hopefully it will be fixed in a short time

@aissat
Copy link
Owner

aissat commented Mar 22, 2020

@AlaaEldeenYsr thnx for this details
@hkndzdr I'm working on ...

@Overman775
Copy link
Collaborator

Overman775 commented Mar 22, 2020

@hkndzdr I'm working on ...

Do you need help?

@aissat
Copy link
Owner

aissat commented Mar 22, 2020

@Overman775 yeah;)

@aissat
Copy link
Owner

aissat commented Mar 22, 2020

#98 (comment)

@Overman775 Overman775 mentioned this issue Mar 22, 2020
@Overman775
Copy link
Collaborator

@hkndzdr @AlaaEldeenYsr PR #99

@hkndzdr
Copy link
Author

hkndzdr commented Mar 25, 2020

@aissat @Overman775
Removing the container widget did not affect the background color. The black screen continues in the same way. (ver. 2.0.2) I keep wrapping it with container widget in the main.dart page.

@aissat
Copy link
Owner

aissat commented Mar 25, 2020

@aissat @Overman775
Removing the container widget did not affect the background color. The black screen continues in the same way. (ver. 2.0.2) I keep wrapping it with container widget in the main.dart page.

@moritzmorgenroth

@moritzmorgenroth
Copy link
Contributor

@hkndzdr I cannot reproduct this. The EasyLocalization widget is not doing any blocking/asynchronous tasks any more. Can you share your sourcecode?

@hkndzdr
Copy link
Author

hkndzdr commented Mar 25, 2020

@hkndzdr I cannot reproduct this. The EasyLocalization widget is not doing any blocking/asynchronous tasks any more. Can you share your sourcecode?

I share videos instead of code. I used the Sample application in the repo.

https://www.youtube.com/watch?v=XpCKjeYuRjo

@Overman775
Copy link
Collaborator

@hkndzdr I cannot reproduct this. The EasyLocalization widget is not doing any blocking/asynchronous tasks any more. Can you share your sourcecode?

I have same bug,not always.... catch on 10 attempt

  runApp(Container(
    color: Colors.red,
    child: EasyLocalization(
      child: MyApp(),

@Overman775
Copy link
Collaborator

Overman775 commented Mar 25, 2020

@moritzmorgenroth @aissat

in 9/10 text flickering, 1/10 black screen(red container)
ScreenRecorderProject10

@hkndzdr
Copy link
Author

hkndzdr commented Mar 25, 2020

@hkndzdr I cannot reproduct this. The EasyLocalization widget is not doing any blocking/asynchronous tasks any more. Can you share your sourcecode?

I have same bug,not always.... catch on 10 attempt

  runApp(Container(
    color: Colors.red,
    child: EasyLocalization(
      child: MyApp(),

Yes. The situation changes according to the current memory load of the device. I shared the image on the emulator so you can look clear.

@Overman775
Copy link
Collaborator

@moritzmorgenroth
Copy link
Contributor

moritzmorgenroth commented Mar 25, 2020

in 9/10 text flickering, 1/10 black screen(red container)
ScreenRecorderProject10

@Overman775 the flickering is due to the async/non blocking shared preference language loading. The red screen is a mistery to me. Maybe we need to separate the use cases for using the system locale and saving/loading a custom local at a higher level to avoid this kind of behavior...

@Overman775
Copy link
Collaborator

Overman775 commented Mar 25, 2020

Are you sure you updated the version in your

@moritzmorgenroth Yep, latest 2.0.2

Text flickering cannot be deleted because we are use async loading from the asset

@moritzmorgenroth
Copy link
Contributor

@Overman775 the flickering is due to the async/non blocking shared preference language loading. The red screen is a mistery to me. Maybe we need to separate the use cases for using the system locale and saving/loading a custom local at a higher level to avoid this kind of behavior...

@aissat @Overman775 would you prefer a loader widget? We could go back to loader, but then we should make sure that async/blocking behavior is only happening if the saveLocale feature is used

@Overman775
Copy link
Collaborator

@aissat @moritzmorgenroth If we get back to FutureBuilder then need to track three parameters:

  1. asset loader,
  2. device locale if save locale null,
  3. save locale if enabled

@aissat
Copy link
Owner

aissat commented Mar 25, 2020

@moritzmorgenroth @Overman775

@Overman775 the flickering is due to the async/non blocking shared preference language loading. The red screen is a mistery to me. Maybe we need to separate the use cases for using the system locale and saving/loading a custom local at a higher level to avoid this kind of behavior...

@aissat @Overman775 would you prefer a loader widget? We could go back to loader, but then we should make sure that async/blocking behavior is only happening if the saveLocale feature is used
@moritzmorgenroth @Overman775
i don't like it but need a solution

@Overman775
Copy link
Collaborator

i don't like it but need a solution

@aissat @moritzmorgenroth can try the idea catch widget.children #102

@moritzmorgenroth
Copy link
Contributor

I think the most convenient / efficient solution would be to adjust the documentation, only setting locale: EasyLocalization.of(context).locale, on the material widget if you want to use the save locale. Then we can do a futurebuilder if savelocal is used and else the flutter system stuff will do its magic and we dont bloc anything with future builder.

@moritzmorgenroth
Copy link
Contributor

I think the use cases are so inherently different that they need stronger distinction. I have a clear picture in my head, dont know if ill find time to implement it before the weekend though...

@aissat
Copy link
Owner

aissat commented Mar 25, 2020

@aissat @moritzmorgenroth If we get back to FutureBuilder then need to track three parameters:

1. asset loader,

2. device locale if save locale null,

3. save locale if enabled

#103 coz asset loader,

@AlaaEldeenYsr
Copy link

AlaaEldeenYsr commented Mar 26, 2020

You updated the package and didn't provide any way for handling the loading operation ?

@Overman775
Copy link
Collaborator

@hkndzdr Black screen is only in develop version, i test on 6 years old android phone, all fine ;)

@hkndzdr
Copy link
Author

hkndzdr commented Mar 28, 2020

@hkndzdr Black screen is only in develop version, i test on 6 years old android phone, all fine ;)

I'm glad to hear that..

@aissat aissat linked a pull request Apr 2, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants