ClampingScrollSimulation constructor Null safety

ClampingScrollSimulation(
  1. {required double position,
  2. required double velocity,
  3. double friction = 0.015,
  4. Tolerance tolerance = Tolerance.defaultTolerance}
)

Creates a scroll physics simulation that matches Android scrolling.

Implementation

ClampingScrollSimulation({
  required this.position,
  required this.velocity,
  this.friction = 0.015,
  super.tolerance,
}) : assert(_flingVelocityPenetration(0.0) == _initialVelocityPenetration) {
  _duration = _flingDuration(velocity);
  _distance = (velocity * _duration / _initialVelocityPenetration).abs();
}