isPointerOverScrollbar method Null safety

  1. @protected
bool isPointerOverScrollbar(
  1. Offset position,
  2. PointerDeviceKind kind,
  3. {bool forHover = false}
)

Returns true if the provided Offset is located over the track or thumb of the RawScrollbar.

The hit test area for mouse hovering over the scrollbar is larger than regular hit testing. This is to make it easier to interact with the scrollbar and present it to the mouse for interaction based on proximity. When forHover is true, the larger hit test area will be used.

Implementation

@protected
bool isPointerOverScrollbar(Offset position, PointerDeviceKind kind, { bool forHover = false }) {
  if (_scrollbarPainterKey.currentContext == null) {
    return false;
  }
  final Offset localOffset = _getLocalOffset(_scrollbarPainterKey, position);
  return scrollbarPainter.hitTestInteractive(localOffset, kind, forHover: true);
}