Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove overscroll on ios?

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 ?

like image 339
Sergey Frolov Avatar asked Oct 31 '19 14:10

Sergey Frolov


People also ask

What is overscroll-behavior in CSS?

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.

Does Safari support overscroll-behavior?

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 …

What can I do with overscroll-behavior?

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!

How do I prevent the page from scrolling on a modal?

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.


Video Answer


1 Answers

You don't need to do those fancy stuff if you only want to remove overscroll behavior on iOS. Simply, use:

ListView(
  physics: ClampingScrollPhysics(),
)
like image 86
iDecode Avatar answered Oct 29 '22 22:10

iDecode