DrivenScrollActivity constructor Null safety
- ScrollActivityDelegate delegate,
- {required double from,
- required double to,
- required Duration duration,
- required Curve curve,
- required TickerProvider vsync}
Creates an activity that animates a scroll view based on animation parameters.
All of the parameters must be non-null.
Implementation
DrivenScrollActivity(
super.delegate, {
required double from,
required double to,
required Duration duration,
required Curve curve,
required TickerProvider vsync,
}) : assert(from != null),
assert(to != null),
assert(duration != null),
assert(duration > Duration.zero),
assert(curve != null) {
_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 first
}