AnimationController constructor

AnimationController({
  1. double? value,
  2. Duration? duration,
  3. Duration? reverseDuration,
  4. String? debugLabel,
  5. double lowerBound = 0.0,
  6. double upperBound = 1.0,
  7. AnimationBehavior animationBehavior = AnimationBehavior.normal,
  8. required TickerProvider vsync,
})

Creates an animation controller.

  • value is the initial value of the animation. If defaults to the lower bound.

  • duration is the length of time this animation should last.

  • debugLabel is a string to help identify this animation during debugging (used by toString).

  • lowerBound is the smallest value this animation can obtain and the value at which this animation is deemed to be dismissed. It cannot be null.

  • upperBound is the largest value this animation can obtain and the value at which this animation is deemed to be completed. It cannot be null.

  • vsync is the required TickerProvider for the current context. It can be changed by calling resync. See TickerProvider for advice on obtaining a ticker provider.

Implementation

AnimationController({
  double? value,
  this.duration,
  this.reverseDuration,
  this.debugLabel,
  this.lowerBound = 0.0,
  this.upperBound = 1.0,
  this.animationBehavior = AnimationBehavior.normal,
  required TickerProvider vsync,
}) : assert(upperBound >= lowerBound),
     _direction = _AnimationDirection.forward {
  if (kFlutterMemoryAllocationsEnabled) {
    _maybeDispatchObjectCreation();
  }
  _ticker = vsync.createTicker(_tick);
  _internalSetValue(value ?? lowerBound);
}