Black screen appears for a short amount of time when changing from one Material App to another one
Black screen appears for a short amount of time when changing from one Material App to another one. This only happens if I set localizationDelegates of MaterialApp.
You can run the following repo to reproduce the issue:
https://github.com/figengungor/localization_black_screen
I am not sure what causes that black screen. Do you have any idea?
localization
add a comment |
Black screen appears for a short amount of time when changing from one Material App to another one. This only happens if I set localizationDelegates of MaterialApp.
You can run the following repo to reproduce the issue:
https://github.com/figengungor/localization_black_screen
I am not sure what causes that black screen. Do you have any idea?
localization
Why create a new materialapp when you can update its children?
– Rémi Rousselet
Nov 23 '18 at 8:38
I want to wrap MaterialApp with DataProvider when stream has data so all routes can access that data.
– Figen Güngör
Nov 23 '18 at 8:41
Yeah but that doesn't mean you have to recreate a MaterialApp
– Rémi Rousselet
Nov 23 '18 at 8:43
What is your suggestion?
– Figen Güngör
Nov 23 '18 at 8:43
Use InheritedWidgets such asThemeor some custom ones. You won't recreate the MaterialApp but the behavior is the same
– Rémi Rousselet
Nov 23 '18 at 8:44
add a comment |
Black screen appears for a short amount of time when changing from one Material App to another one. This only happens if I set localizationDelegates of MaterialApp.
You can run the following repo to reproduce the issue:
https://github.com/figengungor/localization_black_screen
I am not sure what causes that black screen. Do you have any idea?
localization
Black screen appears for a short amount of time when changing from one Material App to another one. This only happens if I set localizationDelegates of MaterialApp.
You can run the following repo to reproduce the issue:
https://github.com/figengungor/localization_black_screen
I am not sure what causes that black screen. Do you have any idea?
localization
localization
asked Nov 23 '18 at 8:22
Figen Güngör
2,76074080
2,76074080
Why create a new materialapp when you can update its children?
– Rémi Rousselet
Nov 23 '18 at 8:38
I want to wrap MaterialApp with DataProvider when stream has data so all routes can access that data.
– Figen Güngör
Nov 23 '18 at 8:41
Yeah but that doesn't mean you have to recreate a MaterialApp
– Rémi Rousselet
Nov 23 '18 at 8:43
What is your suggestion?
– Figen Güngör
Nov 23 '18 at 8:43
Use InheritedWidgets such asThemeor some custom ones. You won't recreate the MaterialApp but the behavior is the same
– Rémi Rousselet
Nov 23 '18 at 8:44
add a comment |
Why create a new materialapp when you can update its children?
– Rémi Rousselet
Nov 23 '18 at 8:38
I want to wrap MaterialApp with DataProvider when stream has data so all routes can access that data.
– Figen Güngör
Nov 23 '18 at 8:41
Yeah but that doesn't mean you have to recreate a MaterialApp
– Rémi Rousselet
Nov 23 '18 at 8:43
What is your suggestion?
– Figen Güngör
Nov 23 '18 at 8:43
Use InheritedWidgets such asThemeor some custom ones. You won't recreate the MaterialApp but the behavior is the same
– Rémi Rousselet
Nov 23 '18 at 8:44
Why create a new materialapp when you can update its children?
– Rémi Rousselet
Nov 23 '18 at 8:38
Why create a new materialapp when you can update its children?
– Rémi Rousselet
Nov 23 '18 at 8:38
I want to wrap MaterialApp with DataProvider when stream has data so all routes can access that data.
– Figen Güngör
Nov 23 '18 at 8:41
I want to wrap MaterialApp with DataProvider when stream has data so all routes can access that data.
– Figen Güngör
Nov 23 '18 at 8:41
Yeah but that doesn't mean you have to recreate a MaterialApp
– Rémi Rousselet
Nov 23 '18 at 8:43
Yeah but that doesn't mean you have to recreate a MaterialApp
– Rémi Rousselet
Nov 23 '18 at 8:43
What is your suggestion?
– Figen Güngör
Nov 23 '18 at 8:43
What is your suggestion?
– Figen Güngör
Nov 23 '18 at 8:43
Use InheritedWidgets such as
Theme or some custom ones. You won't recreate the MaterialApp but the behavior is the same– Rémi Rousselet
Nov 23 '18 at 8:44
Use InheritedWidgets such as
Theme or some custom ones. You won't recreate the MaterialApp but the behavior is the same– Rémi Rousselet
Nov 23 '18 at 8:44
add a comment |
1 Answer
1
active
oldest
votes
Your issue happens because you update the widget tree from
Foo
MaterialApp
to
Foo
Bar
MaterialApp
This makes flutter hard reset the state of MaterialApp, triggering to loading.
You should avoid this in general. It'd be better to either always insert Bar with null datas, or use a GlobalKey as such:
final key = GlobalKey();
// ...
Widget build(BuildContext context) {
final app = MaterialApp(key: key);
return someCondition
? Bar(child: app)
: app;
}
GlobalKey purposefully reuse the previous Element associated with the key
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442946%2fblack-screen-appears-for-a-short-amount-of-time-when-changing-from-one-material%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your issue happens because you update the widget tree from
Foo
MaterialApp
to
Foo
Bar
MaterialApp
This makes flutter hard reset the state of MaterialApp, triggering to loading.
You should avoid this in general. It'd be better to either always insert Bar with null datas, or use a GlobalKey as such:
final key = GlobalKey();
// ...
Widget build(BuildContext context) {
final app = MaterialApp(key: key);
return someCondition
? Bar(child: app)
: app;
}
GlobalKey purposefully reuse the previous Element associated with the key
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
add a comment |
Your issue happens because you update the widget tree from
Foo
MaterialApp
to
Foo
Bar
MaterialApp
This makes flutter hard reset the state of MaterialApp, triggering to loading.
You should avoid this in general. It'd be better to either always insert Bar with null datas, or use a GlobalKey as such:
final key = GlobalKey();
// ...
Widget build(BuildContext context) {
final app = MaterialApp(key: key);
return someCondition
? Bar(child: app)
: app;
}
GlobalKey purposefully reuse the previous Element associated with the key
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
add a comment |
Your issue happens because you update the widget tree from
Foo
MaterialApp
to
Foo
Bar
MaterialApp
This makes flutter hard reset the state of MaterialApp, triggering to loading.
You should avoid this in general. It'd be better to either always insert Bar with null datas, or use a GlobalKey as such:
final key = GlobalKey();
// ...
Widget build(BuildContext context) {
final app = MaterialApp(key: key);
return someCondition
? Bar(child: app)
: app;
}
GlobalKey purposefully reuse the previous Element associated with the key
Your issue happens because you update the widget tree from
Foo
MaterialApp
to
Foo
Bar
MaterialApp
This makes flutter hard reset the state of MaterialApp, triggering to loading.
You should avoid this in general. It'd be better to either always insert Bar with null datas, or use a GlobalKey as such:
final key = GlobalKey();
// ...
Widget build(BuildContext context) {
final app = MaterialApp(key: key);
return someCondition
? Bar(child: app)
: app;
}
GlobalKey purposefully reuse the previous Element associated with the key
answered Nov 23 '18 at 8:48
Rémi Rousselet
24.9k24783
24.9k24783
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
add a comment |
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Thank you. GlobalKey solved the issue. But I had to do a couple more extra weird things , too. The thing is I am changing the home according to a condition. If it has data, it shows HomePage. But If it doesn't I show a InputScreen and from that screen you navigate to another screen(Splash) and this screen also stays on top of everything even if I have data and it supposed to show HomePage but I see in my Flutter Inspector both Splash and Home is in there under MaterialApp, so what I did was listening the stream and when there is data I pop SplashPage.
– Figen Güngör
Nov 23 '18 at 10:04
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Do you mind creating another question or slack? I honestly don't get the problem and comments aren't ideal
– Rémi Rousselet
Nov 23 '18 at 10:09
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Sure thing! I'll update repo.
– Figen Güngör
Nov 23 '18 at 10:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
Okey my brain started to work while updating the repo. Of course it'll show SplashScreen because I navigated to it from home.What was I thinking?Doh! So even though home is updated with my HomePage I need to go back from route stack to see it. So I ended up handling InputPage and SplashPage Content inside one page so no navigation business here. Thank you for your help and interest, Remi.
– Figen Güngör
Nov 23 '18 at 12:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442946%2fblack-screen-appears-for-a-short-amount-of-time-when-changing-from-one-material%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why create a new materialapp when you can update its children?
– Rémi Rousselet
Nov 23 '18 at 8:38
I want to wrap MaterialApp with DataProvider when stream has data so all routes can access that data.
– Figen Güngör
Nov 23 '18 at 8:41
Yeah but that doesn't mean you have to recreate a MaterialApp
– Rémi Rousselet
Nov 23 '18 at 8:43
What is your suggestion?
– Figen Güngör
Nov 23 '18 at 8:43
Use InheritedWidgets such as
Themeor some custom ones. You won't recreate the MaterialApp but the behavior is the same– Rémi Rousselet
Nov 23 '18 at 8:44