onHorizontalDragEnd method

void onHorizontalDragEnd(
  1. DragEndDetails details
)

Implementation

void onHorizontalDragEnd(DragEndDetails details) {
  animationController.value = translateX;
  if (details.velocity.pixelsPerSecond.dx > 200) {
    close();
  } else if (details.velocity.pixelsPerSecond.dx < -200) {
    open();
  } else {
    if (translateX.abs() > maxDragDistance / 2) {
      open();
    } else {
      close();
    }
  }
}