isAtSnapOffset<T> method

bool isAtSnapOffset<T>({
  1. required MultiStateSheetExtent<T> extent,
  2. required double toleranceDistance,
})

Checks if the current offset is at a snapping position.

  • extent: The current extent of the sheet.
  • toleranceDistance: The allowed tolerance for the offset to be considered at a snapping position.
  • Returns: true if the offset is close to a snapping position, false otherwise.

Implementation

bool isAtSnapOffset<T>({
  required MultiStateSheetExtent<T> extent,
  required double toleranceDistance,
}) =>
    snappingPixelOffsets.any((snapOffset) =>
        (extent.offset - snapOffset).abs() <= toleranceDistance) ||
    extent.offset >= extent.maxOffset;