return NotificationListener<ScrollNotification>(
onNotification: (scrollNotification) {
if (scrollNotification is ScrollStartNotification) {
// do something when it starts scrolling
} else if (scrollNotification is ScrollUpdateNotification) {
// do something else, or nothing
} else if (scrollNotification is ScrollEndNotification) {
// do something when it stops scrolling
}
return false;
},
child: ListView.builder(
itemCount: 20,
itemBuilder: (_, index) {
return ListTile(
title: Text('Item $index'),
);
},
),
);
1条答案
按热度按时间zvokhttg1#
您可以使用
NotificationListener<ScrollNotification>
来观察小工具何时滚动。例如: