handleThumbPressStart method

  1. @protected
  2. @mustCallSuper
void handleThumbPressStart(
  1. Offset localPosition
)

Handler called when a long press gesture has started.

Begins the fade out animation and creates the thumb's DragScrollController.

Implementation

@protected
@mustCallSuper
void handleThumbPressStart(Offset localPosition) {
  assert(_debugCheckHasValidScrollPosition());
  final Axis? direction = getScrollbarDirection();
  if (direction == null) {
    return;
  }
  _fadeoutTimer?.cancel();
  _fadeoutAnimationController.forward();

  assert(_thumbDrag == null);
  final ScrollPosition position = _cachedController!.position;
  final RenderBox renderBox = _scrollbarPainterKey.currentContext!.findRenderObject()! as RenderBox;
  final DragStartDetails details = DragStartDetails(
    localPosition: localPosition,
    globalPosition: renderBox.localToGlobal(localPosition),
  );
  _thumbDrag = position.drag(details, _disposeThumbDrag);
  assert(_thumbDrag != null);
  assert(_thumbHold == null);

  _startDragScrollbarAxisOffset = localPosition;
  _lastDragUpdateOffset = localPosition;
  _startDragThumbOffset = scrollbarPainter.getThumbScrollOffset();
}