1

I have an app with a bunch of text views inside a form. When the form scrolls, I lose the text entered in the above text fields. I would like to preserve those values. I tried adding a controller and assigning the value to a variable inside the state class but it does not work.

P.S not just widgets, but almost every type of input for example drop down buttons, radio buttons and what not.

3
  • add code whatever you tried. Apr 19, 2020 at 18:09
  • I guess I know what the problem is, I have divided the forms into smaller ones for modularity. Those forms themselves are inside a list view. Reading stackoverflow.com/questions/51071906/…, my guess is that ListView is destroying those forms when they are not visible destroying my state which is causing the problem @VirenVVarasadiya
    – Hemil
    Apr 19, 2020 at 18:11
  • 1
    @VirenVVarasadiya I just confirmed that. I set a breakpoint on the dispose method and by scrolling far enough, dispose is being called which is destroying my state
    – Hemil
    Apr 19, 2020 at 18:13

1 Answer 1

1

I had a bunch of small forms inside a list view. Turns out, scrolling far enough, destroys the forms not visible to the user destroying their state. I need to lift their state up to the parent widget. For more information on how to do that, check how to keep the state of my widgets after scrolling?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.