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

╄→尐↘猪︶ㄣ 提交于 2020-01-04 06:50:43

问题


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?


回答1:


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.




回答2:


you can solve this problem using two method.

1) if You can afford bounce back effect then simply use ListView.builder's property physics and set value BouncingScrollPhysics().

physics: BouncingScrollPhysics(),

2) you can also solve using ScrollConfiguration and costume ScrollBehavior. in details



来源:https://stackoverflow.com/questions/53153219/how-can-i-disable-the-animation-when-you-scroll-all-the-way-to-the-top-in-listvi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!