Michel Feinstein
Michel Feinstein

Reputation: 14276

How to force iOS scroll behavior on Android with Flutter?

In Android Flutter will add a GlowingOverscrollIndicator as a ScrollBehavior, I would like to know what's the name of the iOS ScrollBehavior that Flutter uses, as I can't find it on the repo and I would like to force it on both Android and iOS.

Upvotes: 4

Views: 4322

Answers (3)

Valkyrie
Valkyrie

Reputation: 109

In addition to the previous answers:

to ensure that the ListView stays scrollable you should set AlwaysScrollableScrollPhysics as a parent:

BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics())

Without this it did not work in my case.

Upvotes: 1

elhoucine ayoub
elhoucine ayoub

Reputation: 1009

iOS scroll behavior set :

physics: BouncingScrollPhysics(),

Android scroll behavior set :

physics: ClampingScrollPhysics(),

depends on platform default scroll behavior set :

physics: AlwaysScrollableScrollPhysics(),

Upvotes: 9

Michel Feinstein
Michel Feinstein

Reputation: 14276

In order to force the iOS scroll behavior on a ListView or a CustomScrollView, just set:

physics: BouncingScrollPhysics()

Upvotes: 2

Related Questions