flipHorizontal method

void flipHorizontal()

Flip the image horizontally. Data flipX snaps; the visible flip runs as a card flip — Y-axis tilt eased from π → 0 — over kAnimation.

The flip mirrors the CROPPED VIEW in place (telegram's model), not the image about its own centre: the pan offset is mirrored about the crop-centre axis so the content inside the crop stays put and mirrors, instead of sliding sideways when the crop is off-centre.

Implementation

void flipHorizontal() {
  _settleAnimator.cancel();
  imageTransform.flipX = imageTransform.flip ? 1 : -1;
  imageTransform.offset = math.Vector3(
    2 * (crop.center.dx - imageSize.width / 2) - imageTransform.offset.x,
    imageTransform.offset.y,
    0,
  );
  imageTransform.notifyListeners();
  _flipDecoration = dartmath.pi;
  _hideBackdrop(animated: false);
  _flipAnimator.animate(target: 0).then((_) {
    if (!disposed) _showBackdrop(animated: false);
  }).unawaited();
}