onDragEnd method

void onDragEnd(
  1. DragEndDetails details
)

if _shouldToggle returns true, it will try to open or dismiss the SlidablePanel continually otherwise, it will reset the SlidablePanel to the previous position

Implementation

void onDragEnd(DragEndDetails details) async {
  assert(layoutSize != null);

  final target = layoutSize!.getToggleTarget(direction, ratio, _forwarding);

  final draggedRatio = _forwarding ? absoluteRatio : 1 - absoluteRatio;
  final needToggle = _shouldToggle(draggedRatio);

  if (ratio != target && needToggle) {
    await _animationController.animateTo(
      target,
      duration: const Duration(milliseconds: 200),
    );
  } else if (!needToggle) {
    final target =
        _forwarding ? _middleBound : (ratio > 0 ? _upperBound : _lowerBound);

    await _animationController.animateTo(
      target,
      duration: const Duration(milliseconds: 200),
    );
  }

  _resetDrag();
}