endSlide method

void endSlide(
  1. ScaleEndDetails details
)

Implementation

void endSlide(ScaleEndDetails details) {
  if (mounted && _isSliding) {
    final bool popPage = widget.slideEndHandler?.call(
          _offset,
          state: this,
          details: details,
        ) ??
        defaultSlideEndHandler(
          offset: _offset,
          pageSize: pageSize,
          pageGestureAxis: widget.slideAxis,
        );

    if (popPage) {
      setState(() {
        _popping = true;
        _isSliding = false;
      });
      Navigator.pop(context);
    } else {
      //_isSliding=false;
      if (_offset != Offset.zero || _scale != 1.0) {
        _backOffsetAnimation = _backAnimationController
            .drive(Tween<Offset>(begin: _offset, end: Offset.zero));
        _backScaleAnimation = _backAnimationController
            .drive(Tween<double>(begin: _scale, end: 1.0));
        _offset = Offset.zero;
        _scale = 1.0;
        _backAnimationController.reset();
        _backAnimationController.forward();
      } else {
        setState(() {
          _isSliding = false;
        });
      }
    }
  }
}