-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Stateful widget not being restored with ValueKey #16
Comments
Hi @melio-matt Can you please provide some test cases or any screenshots or a video that how are you implementing it and what are you trying to do? Thanks |
Hi @nixrajput I've added below some code that illustrates what I'm doing. The floating button when clicked alters the state and removes one of the pages from the carousel. Before pressing this, navigate to the last page and enter some text into the box, then press the button. You will then see the input box no longer has the text present. There is some commented out code that switches out the local and global keys. Once swapped round and you repeat the above action you will see the text is maintained in the input box. regards
|
Hi @melio-matt I will look into this and I will definitely revert back to you after testing and solution. Please have some patience. Thanks and regards, |
Thanks @nixrajput No massive urgency, I have a solution that works for me at the moment and will be easy enough to put back in the more permanent solution. Matthew |
Hello
I've created a carousel by supplying an array of stateful widgets and when the provider signals, this will be reconstructed as part of the normal build process. On the rebuild and the array changing dimension I loose the state of my widgets, which do have ValueKeys on each. Switching the key to a GlobalKey means I retain the state, but there are obvious reasons for not wanting to use GlobalKeys.
I didn't find anything in the documentation about this, so I assumed that it should work the same way as other lists where the position of a widget can be changed using local keys.
regards
Matthew
The text was updated successfully, but these errors were encountered: