79520893

Date: 2025-03-19 17:04:31
Score: 0.5
Natty:
Report link

This is great and all but I wanted to share a way to know if the user has released the scrollView. That's basically when the user has stopped scrolling (even though the scrollView is still scrolling because of the velocity of the users drag.)

Here we would would need to check when the dragDetails is null. This is because the user isn't dragging the screen anymore. It isn't the best solution because there may be edge cases that I haven't seen yet but it works.πŸ™ŒπŸ½

NotificationListener<ScrollNotification>(
  onNotification: (ScrollNotification notification) {
    if (notification is ScrollUpdateNotification) {
      if (notification.dragDetails == null) {
        // User has just released the ScrollView
        print('User released the ScrollView');
        // Your code to handle release goes here
      }
    }
    return true;
  },
  child: ListView.builder(
    itemCount: 50,
    itemBuilder: (context, index) => ListTile(
      title: Text('Item $index'),
    ),
  ),
)

(P.S, this is my first answer on StackOverflow. go easy on meπŸ™‡πŸ½)

Reasons:
  • Blacklisted phrase (1): StackOverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: lukasiuu