Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter - How to prevent BouncingScrollPhysys from bouncing when it reach the end of a CustomScrollView?

BouncingScrollPhysics by default bounce at the start and end of a ScrollView but I would like to over ride that. How can I accomplish that?

like image 799
braulio.cassule Avatar asked Mar 06 '18 21:03

braulio.cassule


People also ask

How do you remove the glow effect in flutter?

The glow effect comes from GlowingOverscrollIndicator added by ScrollBehavior. To remove this effect, you need to specify a custom ScrollBehavior. For that, simply wrap any given part of your application into a ScrollConfiguration with the desired ScrollBehavior.

What is ClampingScrollPhysics?

ClampingScrollPhysics class Null safety. Scroll physics for environments that prevent the scroll offset from reaching beyond the bounds of the content. This is the behavior typically seen on Android. See also: ScrollConfiguration, which uses this to provide the default scroll behavior on Android.

What is bouncing scroll physics flutter?

BouncingScrollPhysics class Null safety. Scroll physics for environments that allow the scroll offset to go beyond the bounds of the content, but then bounce the content back to the edge of those bounds. This is the behavior typically seen on iOS.


1 Answers

You can set physics on CustomScrollView to whatever fits your need this way :

new CustomScrollView(
  physics: new ClampingScrollPhysics(),
  ...
);

For example you can use ClampingScrollPhysics, which will stop at the end of the scroll with nothing else.

like image 148
Rémi Rousselet Avatar answered Oct 30 '22 22:10

Rémi Rousselet