handleHover method

  1. @protected
  2. @mustCallSuper
void handleHover(
  1. PointerHoverEvent event
)

Cancels the fade out animation so the scrollbar will remain visible for interaction.

Can be overridden by subclasses to respond to a PointerHoverEvent.

Helper methods isPointerOverScrollbar, isPointerOverThumb, and isPointerOverTrack can be used to determine the location of the pointer relative to the painter scrollbar elements.

Implementation

@protected
@mustCallSuper
void handleHover(PointerHoverEvent event) {
  // Check if the position of the pointer falls over the painted scrollbar
  if (isPointerOverScrollbar(event.position, event.kind, forHover: true)) {
    _hoverIsActive = true;
    // Bring the scrollbar back into view if it has faded or started to fade
    // away.
    _fadeoutAnimationController.forward();
    _fadeoutTimer?.cancel();
  } else if (_hoverIsActive) {
    // Pointer is not over painted scrollbar.
    _hoverIsActive = false;
    _maybeStartFadeoutTimer();
  }
}