-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
initState is being called on the Silidable child when it closes or opens #51
Comments
Is there any progress for this bug? It is really anoying that initState is called 1-3 times while the item is slided. |
Hello - can this please be prioritised? Its common to have animations in widgets and/or network request to get data. I have tried to find a workaround, but it seems impossible with current implementation. |
Any progress ?? |
The widget is rebuilding because some widgets are removed/added in the tree during the animation. I will see if I can remove this behavior in my refactoring. |
For info, this behavior also happens with ValueListenableBuilder in the child's subtree. ( Many thanks for the package! ) |
I've found that if you set a GlobalKey on your Slidable's child it fixes (works around?) this issue. My understanding is that it is caused by the child moving within the widget tree, setting a key allows it to reuse its state under a different parent as explained here: https://www.youtube.com/watch?v=kn0EOS-ZiIc&feature=youtu.be&t=510 |
I think this will be fixed in the upcoming version. Can someone test it with the revival branch? |
Ill try to test this ASAP |
Is this problem fixed. After some investigations, I found out that the problem is related to using InheritedWidget and changing the widget hierarchy when closing the slider. One potential solution would be to only use Stateful and Stateless widgets, and propagating the data for all Slidablechilds. |
Fixed in 1.0 |
Is this a bug? This behavior is not expected to happen. One example could be a network request inside the slidable's child, where you don't want to call this operation every time the user interacts with the slidable.
Here is a sample code.
The text was updated successfully, but these errors were encountered: