updateAnimation method

void updateAnimation(
  1. ExtendedImageGestureState state
)

Execute scale animation when double tap. 双击时执行缩放动画

Implementation

void updateAnimation(ExtendedImageGestureState state) {
  final double begin = state.gestureDetails!.totalScale!;
  final double end = state.gestureDetails!.totalScale! == 1.0 ? 3.0 : 1.0;
  final Offset pointerDownPosition = state.pointerDownPosition!;

  _doubleTapAnimation?.removeListener(_doubleTapListener);
  _doubleTapAnimationController
    ..stop()
    ..reset();
  _doubleTapListener = () {
    state.handleDoubleTap(
      scale: _doubleTapAnimation!.value,
      doubleTapPosition: pointerDownPosition,
    );
  };
  _doubleTapAnimation = Tween<double>(
    begin: begin,
    end: end,
  ).animate(_doubleTapCurveAnimation)
    ..addListener(_doubleTapListener);
  _doubleTapAnimationController.forward();
}