By default, flutter adds a overscroll
effect on ListView/GridView/...
on ios
I would like to remove this effect entirely or on one specific scrollable.
What can I do ?
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area. It's a shorthand for overscroll-behavior-x and overscroll-behavior-y. By default, mobile browsers tend to provide a "bounce" effect or even a page refresh when the top or bottom of a page (or other scroll area) is reached.
Bramus! May 2, 2016 UPDATE 2017.12: For non-Safari browsers (e.g. Chrome, Firefox) you can use overscroll-behavior to solve exactly this. Simply apply overscroll-behavior-y: none; on html, body and be done with it. Safari however does not support it …
You can use it to cancel scroll chaining, disable/customize the pull-to-refresh action, disable rubberbanding effects on iOS (when Safari implements overscroll-behavior ), and more. The best part is that using overscroll-behavior does not adversely affect page performance like the hacks mentioned in the intro!
Now we’re going to apply this height to the html and body elements when our modal is activated. This prevents the page from scrolling. We’ll add an is-locked class to our html element when we show the modal. When the is-locked class is assigned we use it to set the required styles so the page cannot be scrolled.
You don't need to do those fancy stuff if you only want to remove overscroll behavior on iOS. Simply, use:
ListView(
physics: ClampingScrollPhysics(),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With