forward method

void forward()

Starts the forward animation, initializing controllers if necessary. When completed and not rejectable, automatically reverses the animation.

Implementation

void forward() {
  assert(!isRejectable ? callback != null : true);
  _whenPhase(TouchScaleCallPhase.onAccepted);

  if (_animation == null) {
    _animation = AnimationController(
      vsync: context.vsync,
      duration: context.duration,
      reverseDuration: context.reverseDuration,
    );

    _animation!.addListener(notifyListeners);
    _animation!.addStatusListener((status) {
      if (status == AnimationStatus.completed && !isRejectable) {
        _animation?.reverse();
        _whenPhase(TouchScaleCallPhase.onScaleDownEnd);
      } else if (status == AnimationStatus.dismissed) {
        isRejectable = false;
        _animation?.dispose();
        _animation = null;
        _whenPhase(TouchScaleCallPhase.onScaleUpEnd);
      }
    });

    _curved = CurvedAnimation(
      parent: _animation!,
      curve: context.curve,
      reverseCurve: context.reverseCurve,
    );
  }

  _animation?.forward();
}