Ext*_*tra 2 dart flutter flutter-animation
我正在尝试在我的flutter应用程序中列出一个清单。但是,每次我一直滚动到顶部时,都会显示以下动画:
https://i.stack.imgur.com/Z7mHh.jpg, https://i.stack.imgur.com/EAIyj.jpg
有没有办法隐藏此动画?
小智 16
这将帮助您将其添加到 Listview.builder
physics: ClampingScrollPhysics(),
Run Code Online (Sandbox Code Playgroud)
Vir*_*iya 10
您可以使用两种方法解决此问题。
如果你能负担得起反弹效果,那么只需使用ListView.builder的属性physics并设置如下值BouncingScrollPhysics():
physics: BouncingScrollPhysics()
Run Code Online (Sandbox Code Playgroud)
您也可以使用ScrollConfiguration和自定义来解决它ScrollBehavior。
NotificationListener<OverscrollIndicatorNotification>(
onNotification: (OverscrollIndicatorNotification overscroll) {
overscroll.disallowGlow();
},
child: ListView.builder(...));
Run Code Online (Sandbox Code Playgroud)
正如官方文档所说
GlowingOverscrollIndicator在显示过度滚动指示之前会生成OverscrollIndicatorNotification。为防止指示器显示指示,请在通知上调用OverscrollIndicatorNotification.disallowGlow。