slide method

void slide(
  1. Offset value, {
  2. ExtendedImageGestureState? extendedImageGestureState,
  3. ExtendedImageSlidePageHandlerState? extendedImageSlidePageHandlerState,
})

Implementation

void slide(Offset value,
    {ExtendedImageGestureState? extendedImageGestureState,
    ExtendedImageSlidePageHandlerState? extendedImageSlidePageHandlerState}) {
  if (_backAnimationController.isAnimating) {
    return;
  }
  if (extendedImageGestureState != null) {
    assert(extendedImageGestureState.mounted);
  }
  _extendedImageGestureState = extendedImageGestureState;
  _extendedImageSlidePageHandlerState = extendedImageSlidePageHandlerState;

  if (widget.slideAxis == SlideAxis.horizontal) {
    _offset += Offset(value.dx, 0.0);
  } else if (widget.slideAxis == SlideAxis.vertical) {
    _offset += Offset(0.0, value.dy);
  } else {
    _offset += value;
  }
  _offset = widget.slideOffsetHandler?.call(
        _offset,
        state: this,
      ) ??
      _offset;

  _scale = widget.slideScaleHandler?.call(
        _offset,
        state: this,
      ) ??
      defaultSlideScaleHandler(
          offset: _offset,
          pageSize: pageSize,
          pageGestureAxis: widget.slideAxis);

  //if (_scale != 1.0 || _offset != Offset.zero)
  {
    _isSliding = true;
    if (widget.slideType == SlideType.onlyImage) {
      _extendedImageGestureState?.slide();
      _extendedImageSlidePageHandlerState?.slide();
    }

    if (mounted) {
      setState(() {});
    }
    widget.onSlidingPage?.call(this);
  }
}