getRatio method

double? getRatio(
  1. double dragExtent
)

if no SlideActionPanel, return null by doing so, we could disable sliding if no actions along the axis the ratio would be calculated: dragExtent / slidable space along the axis the slidable space is calculated by maxSlideThreshold * the space along the axis

Implementation

double? getRatio(
  double dragExtent,
) {
  if ((dragExtent > 0 && !hasPreAction) ||
      (dragExtent < 0 && !hasPostAction)) {
    return null;
  }

  final mainAxis = axis == Axis.horizontal
      ? size.width * maxSlideThreshold
      : size.height * maxSlideThreshold;
  final ratio = dragExtent / mainAxis;
  return ratio;
}