-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
I'm having a problem with ListController.animateToItem
inside a child OverlayEntry
suddenly calling OverlayEntry.remove
.
#65
Comments
ListController.animateItem
inside a child OverlayEntry
suddenly calling OverlayEntry.remove
.ListController.animateToItem
inside a child OverlayEntry
suddenly calling OverlayEntry.remove
.
I'm facing same problem, but i'm using Autocomplete, which causes issues when there is running animation and widget get's removed (user changes text such that widget is removed). @gbtb16 have you found workaround? |
I think the issue is that created animation controller is not disposed (leaked) here:
|
The control is disposed when animation is completed super_sliver_list/lib/src/animate_to_item.dart Lines 46 to 48 in a25aa8e
And also when the item is removed during animation super_sliver_list/lib/src/animate_to_item.dart Lines 57 to 61 in a25aa8e
Is there a codepath where the controller is not disposed? |
@knopp I've made PR to address this, there is a code path when ListController is detached in mid-animation, which causes Ticker leak. Animation also needs to be disposed (controller doesn't dispose animations). |
Hi @Zekfad! Thank you for your comment on my issue and the PR you submitted to try to solve this problem. My temporary solution was to use the This fixed the bug and produced a faster but less fluid UI since it's basically a teleport when you consider a rotating list using math modules. I hope your contribution will be reviewed and merged! |
Hi there!
I'm using version
0.4.1
ofsuper_sliver_list
.I have a problem when using an
OverlayEntry
that has as a child a customStatefulWidget
, we can call itXComponent
, which returns a set of items in aCustomScrollView
, along with aSuperSliverList.builder
.In XComponent's initState, there is a controller that references an external ValueNotifier that changes when the user highlights an item. Once the highlight changes, it calls
ListController.animateToItem
to move to the item selected by the text or manually. Visually testing through the app, it's not possible to find the problem. It is seen in my unit tests when selecting an item with the Enter key or left mouse click, which in addition to selecting the item, automatically callsListController.animateToItem
and then closes the overlay and jumps to the next FocusNode.In question, closing the overlay while selecting an item, which in turn calls
ListController.animateToItem
, is where the problem lies. The exception thrown is:First error:
Second error:
Third error:
All the highlighting logic has been tested and proven before, so this wouldn't be your problem.
Studying the case, I imagine the problem is that when an AnimateToItem is created,
animate()
is called immediately after, but these items are never actually disposed of, resulting in a malfunction when externally forced to exit the loop on its own.The text was updated successfully, but these errors were encountered: