hitTestChildren method

  1. @override
bool hitTestChildren(
  1. SliverHitTestResult result, {
  2. double? mainAxisPosition,
  3. double? crossAxisPosition,
})
override

Override this method to check whether any children are located at the given position.

Typically children should be hit-tested in reverse paint order so that hit tests at locations where children overlap hit the child that is visually "on top" (i.e., paints later).

Used by hitTest. If you override hitTest and do not call this function, then you don't need to implement this function.

For a discussion of the semantics of the arguments, see hitTest.

Implementation

@override
bool hitTestChildren(SliverHitTestResult result, {
  double? mainAxisPosition, double? crossAxisPosition,
}) {
  return (foreground != null && _hitTestBoxChild(
    BoxHitTestResult.wrap(result),
    foreground,
    mainAxisPosition: mainAxisPosition!,
    crossAxisPosition: crossAxisPosition!,
  )) || (sliver != null && sliver!.geometry!.hitTestExtent > 0 && sliver!.hitTest(
    result,
    mainAxisPosition: mainAxisPosition!,
    crossAxisPosition: crossAxisPosition!,
  )) || (background != null && _hitTestBoxChild(
    BoxHitTestResult.wrap(result),
    background,
    mainAxisPosition: mainAxisPosition!,
    crossAxisPosition: crossAxisPosition!,
  ));
}