-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
tutorials 010 012 014 view rebuild many times #17
Comments
Remove the '/' from the login. That was my mistake. Adding a / will construct the views based on the deepling protocal so it'll create all views infront of that as well. So use 'login' instead of '/#' |
login----> home : login will build |
Oh you mean that. That's just how Flutter works. It rebuilds for major events like that. Navigation will rebuild, opening the keyboard will rebuild, locking the screen will rebuild, going into background will rebuild, poping a route from navigation will rebuild, etc. Since the UI is a function of state this should be kept in mind because you'll have to write your code to always return the same result giving a state and be able to be executed 100's of times without side effects. Your page will never be rebuilt once ONLY , unless you navigate there, never call set state and never navigate away. Something you shouldn't do below!! If you want to do this you can hack the Flutter approach and use a stateless widget for every widget, keep a local widget with your view that's built once and then only construct that when it's null. Like in this answer. But that is directly fighting against the Flutter patterns. I've never had to do this. Can you tell me the reason you don't want it to rebuild, maybe I can help you solve your root problem |
LoginView push to HomeView, HomeView push to PostView, loginView will rebuild
The text was updated successfully, but these errors were encountered: