Giter Site home page Giter Site logo

Comments (3)

FilledStacks avatar FilledStacks commented on May 10, 2024

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'

from flutter-tutorials.

guoyongsheng avatar guoyongsheng commented on May 10, 2024

login----> home : login will build
home ---> login : login will build
login build many times, i want login build once

from flutter-tutorials.

FilledStacks avatar FilledStacks commented on May 10, 2024

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

from flutter-tutorials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.