How can I disable the animation when you scroll all the way to the top in ListView.builder

Young picture Young · Nov 5, 2018 · Viewed 7.1k times · Source

I'm trying to make a list on my flutter app. But, Every time I scroll all the way to the top there is this animation showing up like this:

https://i.stack.imgur.com/Z7mHh.jpg, https://i.stack.imgur.com/EAIyj.jpg

Is there a way to hide this animation?

Answer

Andrey Turkovsky picture Andrey Turkovsky · Nov 5, 2018
NotificationListener<OverscrollIndicatorNotification>(
    onNotification: (OverscrollIndicatorNotification overscroll) {
      overscroll.disallowGlow();
    },
    child: ListView.builder(...));

As official docs say

GlowingOverscrollIndicator generates OverscrollIndicatorNotification before showing an overscroll indication. To prevent the indicator from showing the indication, call OverscrollIndicatorNotification.disallowGlow on the notification.