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.
BouncingScrollPhysics by itself will not create an overscroll effect if the contents of the scroll view do not extend beyond the size of the viewport. To create the overscroll and bounce effect regardless of the length of your scroll view, combine with AlwaysScrollableScrollPhysics.
const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics())
See also:
- ScrollConfiguration, which uses this to provide the default scroll behavior on iOS.
- ClampingScrollPhysics, which is the analogous physics for Android's clamping behavior.
- ScrollPhysics, for more examples of combining ScrollPhysics objects of different types to get the desired scroll physics.
- Inheritance
-
- Object
- ScrollPhysics
- BouncingScrollPhysics
Constructors
- BouncingScrollPhysics({ScrollPhysics? parent})
-
Creates scroll physics that bounce back from the edge.
const
Properties
- allowImplicitScrolling → bool
-
Whether a viewport is allowed to change its scroll position implicitly in
response to a call to RenderObject.showOnScreen.
read-onlyinherited
- dragStartDistanceMotionThreshold → double
-
The minimum amount of pixel distance drags must move by to start motion
the first time or after each time the drag motion stopped.
read-onlyoverride
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- maxFlingVelocity → double
-
Scroll fling velocity magnitudes will be clamped to this value.
read-onlyinherited
- minFlingDistance → double
-
The minimum distance an input pointer drag must have moved to
to be considered a scroll fling gesture.
read-onlyinherited
- minFlingVelocity → double
-
The minimum velocity for an input pointer drag to be considered a
scroll fling.
read-onlyoverride
- parent → ScrollPhysics?
-
If non-null, determines the default behavior for each method.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- spring → SpringDescription
-
The spring to use for ballistic simulations.
read-onlyinherited
- tolerance → Tolerance
-
The tolerance to use for ballistic simulations.
read-onlyinherited
Methods
-
adjustPositionForNewDimensions(
{required ScrollMetrics oldPosition, required ScrollMetrics newPosition, required bool isScrolling, required double velocity}) → double -
Describes what the scroll position should be given new viewport dimensions.
inherited
-
applyBoundaryConditions(
ScrollMetrics position, double value) → double -
Determines the overscroll by applying the boundary conditions.
override
-
applyPhysicsToUserOffset(
ScrollMetrics position, double offset) → double -
Used by DragScrollActivity and other user-driven activities to convert
an offset in logical pixels as provided by the DragUpdateDetails into a
delta to apply (subtract from the current position) using
ScrollActivityDelegate.setPixels.
override
-
applyTo(
ScrollPhysics? ancestor) → BouncingScrollPhysics -
Combines this ScrollPhysics instance with the given physics.
override
-
buildParent(
ScrollPhysics? ancestor) → ScrollPhysics? -
If parent is null then return ancestor, otherwise recursively build a
ScrollPhysics that has
ancestor
as its parent.protected">@protectedinherited -
carriedMomentum(
double existingVelocity) → double -
Momentum build-up function that mimics iOS's scroll speed increase with repeated flings.
override
-
createBallisticSimulation(
ScrollMetrics position, double velocity) → Simulation? -
Returns a simulation for ballistic scrolling starting from the given
position with the given velocity.
override
-
frictionFactor(
double overscrollFraction) → double - The multiple applied to overscroll to make it appear that scrolling past the edge of the scrollable contents is harder than scrolling the list. This is done by reducing the ratio of the scroll effect output vs the scroll gesture input.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
recommendDeferredLoading(
double velocity, ScrollMetrics metrics, BuildContext context) → bool -
Provides a heuristic to determine if expensive frame-bound tasks should be
deferred.
inherited
-
shouldAcceptUserOffset(
ScrollMetrics position) → bool -
Whether the scrollable should let the user adjust the scroll offset, for
example by dragging.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited