Reputation:
How can I find that the user has lifted his finger off the screen after scrolling the ListView
. I want to use ScrollController.jumpTo(...)
when this event happens. And I couldn't find any callback like this.
PS: I tried using GestureDetector
but nothing worked.
Upvotes: 0
Views: 1476
Reputation: 267404
Wrap your ListView
in NotificationListener
and listens for UserScrollNotification
.
NotificationListener<UserScrollNotification>(
onNotification: (notification) {
if (notification.direction == ScrollDirection.idle) {
print("Scrolling stopped");
}
},
child: ListView.builder(...),
),
Upvotes: 3
Reputation:
I found that.
ScrollController.position.isScrollingNotifier.addListener(() {// scrolling stopped});
If anyone knows a better solution please write it down. I am more than happy to accept your answer.
Upvotes: 2