Issue
I'm using ListView
widget to show items as a list. In a window three, items viewing must the middle item place in the middle.
So how can I detect position of ListView
when scrolling stop?
How to detect ListView Scrolling stopped?
Solution
I used NotificationListener
that is a widget that listens for notifications bubbling up the tree. Then use ScrollEndNotification
, which indicates that scrolling has stopped.
For scroll position I used _scrollController
that type is ScrollController
.
NotificationListener(
child: ListView(
controller: _scrollController,
children: ...
),
onNotification: (t) {
if (t is ScrollEndNotification) {
print(_scrollController.position.pixels);
}
},
),
Answered By - majidfathi69
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.