DraggableIndicatorPhysics class

Shared physics and animation utilities for draggable indicators.

This utility class contains common physics calculations used by widgets with draggable indicators.

Key features:

  • Rubber band resistance for iOS-style overdrag
  • Jelly physics for organic squash and stretch animations
  • Alignment calculations for indicator positioning
  • Velocity-based snapping for natural gesture handling

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

applyRubberBandResistance(double value, {double resistance = 0.4, double maxOverdrag = 0.3}) double
Applies iOS-style rubber band resistance when dragging beyond edges.
buildJellyTransform({required Offset velocity, double maxDistortion = 0.7, double velocityScale = 1000.0}) Matrix4
Creates a jelly transform matrix based on velocity.
computeAlignment(int index, int itemCount) double
Converts an item index to horizontal alignment (-1 to 1).
computeTargetIndex({required double currentRelativeX, required double velocityX, required double itemWidth, required int itemCount, double velocityThreshold = 0.5, double projectionTime = 0.3}) int
Computes the target item index based on drag position and velocity.
getAlignmentFromGlobalPosition(Offset globalPosition, BuildContext context, int itemCount) double
Converts a global drag position to horizontal alignment (-1 to 1).