handlePanUpdate method

void handlePanUpdate(
  1. DragUpdateDetails details
)

Handles pan/drag updates on the scrollbar.

Updates the scroll position based on the drag delta.

Implementation

void handlePanUpdate(DragUpdateDetails details) {
  final delta = scrollDirection == Axis.vertical
      ? details.delta.dy
      : details.delta.dx;
  final maxScroll = this.maxScroll;
  if (maxScroll <= 0) {
    return;
  }
  final scrollDelta = (delta / viewportSize) * contentSize;
  final newScroll = (scroll + scrollDelta).clamp(
    0.0,
    maxScroll,
  );
  scrollProgress = newScroll / maxScroll;
}