DrivenScrollActivity constructor

DrivenScrollActivity(
  1. ScrollActivityDelegate delegate, {
  2. required double from,
  3. required double to,
  4. required Duration duration,
  5. required Curve curve,
  6. required TickerProvider vsync,
})

Creates an activity that animates a scroll view based on animation parameters.

Implementation

DrivenScrollActivity(
  super.delegate, {
  required double from,
  required double to,
  required Duration duration,
  required Curve curve,
  required TickerProvider vsync,
}) : assert(duration > Duration.zero) {
  _completer = Completer<void>();
  _controller = AnimationController.unbounded(
    value: from,
    debugLabel: objectRuntimeType(this, 'DrivenScrollActivity'),
    vsync: vsync,
  )
    ..addListener(_tick)
    ..animateTo(to, duration: duration, curve: curve)
     .whenComplete(_end); // won't trigger if we dispose _controller before it completes.
}