onDragEnd method

void onDragEnd(
  1. DragEndDetails details
)

Implementation

void onDragEnd(DragEndDetails details) {
  // _drag might be null if the drag activity ended and called _disposeDrag.
  assert(_hold == null || _drag == null);
  if (!widget.canScrollPage(extendedImageGestureState?.gestureDetails)) {
    _drag!.end(DragEndDetails(primaryVelocity: 0.0));
    return;
  }
  _drag!.end(details);
  assert(_drag == null);
  // return;
  // DragEndDetails temp = details;
  // if (extendedImageGestureState != null) {
  //   final GestureDetails? gestureDetails =
  //       extendedImageGestureState!.gestureDetails;
  //   final int currentPage = pageController.page!.round();
  //   final bool movePage = pageController.page != currentPage;

  //   if (!widget.canMovePage(gestureDetails)) {
  //     //stop
  //     temp = DragEndDetails(primaryVelocity: 0.0);
  //   }

  //   /// stop when zoom in, so that it will not move to next/previous page
  //   if (!movePage &&
  //       gestureDetails != null &&
  //       gestureDetails.totalScale! > 1.0 &&
  //       (gestureDetails.computeHorizontalBoundary ||
  //           gestureDetails.computeVerticalBoundary)) {
  //     //stop
  //     temp = DragEndDetails(primaryVelocity: 0.0);

  //     // get magnitude from gesture velocity
  //     final double magnitude = details.velocity.pixelsPerSecond.distance;

  //     // do a significant magnitude
  //     if (magnitude.greaterThanOrEqualTo(minMagnitude)) {
  //       Offset direction = details.velocity.pixelsPerSecond /
  //           magnitude *
  //           (extendedImageGestureState!.imageGestureConfig!.inertialSpeed);

  //       if (widget.scrollDirection == Axis.horizontal) {
  //         direction = Offset(direction.dx, 0.0);
  //       } else {
  //         direction = Offset(0.0, direction.dy);
  //       }

  //       _gestureAnimation.animationOffset(
  //           gestureDetails.offset, gestureDetails.offset! + direction);
  //     }
  //   }
  // }

  // _drag!.end(temp);

  // assert(_drag == null);
}