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();
}