I want to add an overscrolls at the end and at the top of the list, only if someone overscrolls.
So... I had a few ideas, I tried to start by using a GestureDetector, and it seems to not work if the list is bigger than the screen, then I went adding a ListView Scroller controller, but it only works if the List is bigger than the screen.
I went ahead an tried to add it through Notification, but it seems too slow.
Any ideas?
class _PullableListState extends State<PullableList> {
double overScrollOnEnd = 0;
@override
Widget build(BuildContext context) {
return NotificationListener<ScrollNotification>(
onNotification: (notification) {
// print(notification.metrics.pixels);
if (notification is OverscrollNotification) {
setState(() {
overScrollOnEnd += notification.dragDetails.delta.dy;
});
print(overScrollOnEnd);
}
if (notification is ScrollUpdateNotification) {
setState(() {
overScrollOnEnd = 0;
});
}
return true;
},
child: Container(
margin: EdgeInsets.only(top: max(overScrollOnEnd, 0)),
child: ListView.builder(
itemBuilder: widget.itemBuilder,
itemCount: widget.itemCount,
),
),
);
}
}