physics property

ScrollPhysics? physics

How the scroll view should respond to user input.

For example, determines how the scroll view continues to animate after the user stops dragging the scroll view (providing a custom implementation of ScrollPhysics.createBallisticSimulation allows this particular aspect of the physics to be overridden).

If an explicit ScrollBehavior is provided to scrollBehavior, the ScrollPhysics provided by that behavior will take precedence after physics.

Defaults to matching platform conventions.

The ScrollPhysics.applyBoundaryConditions implementation of the provided object should not allow scrolling outside the scroll extent range described by the ScrollMetrics.minScrollExtent and ScrollMetrics.maxScrollExtent properties passed to that method. If that invariant is not maintained, the nested scroll view may respond to user scrolling erratically.

This property only applies to the outer scroll view, composed of the slivers returned from headerSliverBuilder. Since the inner scroll view is not directly configured by the NestedScrollView. For both to scroll with the same ScrollPhysics, configure the scroll view of the body the same way if they are expected to match, or use a ScrollBehavior as an ancestor so both the inner and outer scroll views inherit the same ScrollPhysics. This allows for flexible configurations of the NestedScrollView.

The ScrollPhysics also determine whether or not the NestedScrollView can accept input from the user to change the scroll offset. For example, NeverScrollableScrollPhysics typically will not allow the user to drag a scroll view, but in this case, if one of the two scroll views can be dragged, then dragging will be allowed. Configuring both scroll views with NeverScrollableScrollPhysics will disallow dragging in this case.


final ScrollPhysics? physics;