defaultSlideEndHandler function

bool defaultSlideEndHandler({
  1. Offset offset = Offset.zero,
  2. Size pageSize = const Size(100, 100),
  3. SlideAxis pageGestureAxis = SlideAxis.both,
})

Implementation

bool defaultSlideEndHandler({
  Offset offset = Offset.zero,
  Size pageSize = const Size(100, 100),
  SlideAxis pageGestureAxis = SlideAxis.both,
}) {
  const int parameter = 6;
  if (pageGestureAxis == SlideAxis.both) {
    return offset.distance.greaterThan(
        Offset(pageSize.width, pageSize.height).distance / parameter);
  } else if (pageGestureAxis == SlideAxis.horizontal) {
    return offset.dx.abs().greaterThan(pageSize.width / parameter);
  } else if (pageGestureAxis == SlideAxis.vertical) {
    return offset.dy.abs().greaterThan(pageSize.height / parameter);
  }
  return true;
}