checkOffsetAtEdge function

int checkOffsetAtEdge(
  1. double verticalDelta,
  2. ScrollController controller
)

Implementation

int checkOffsetAtEdge(double verticalDelta, ScrollController controller) {
  if (controller.hasClients == false) {
    return 0;
  }
  if (verticalDelta.isNegative) {
    final int dest = (max(verticalDelta, -2) + controller.offset).toInt();
    if (dest < 0) {
      return -1;
    } else {
      return 0;
    }
  } else {
    final int dest = (min(verticalDelta, 2) + controller.offset).toInt();
    final int maxScrollExtent = controller.position.maxScrollExtent.toInt();
    if (dest > maxScrollExtent) {
      return 1;
    } else {
      return 0;
    }
  }
}