hitTestSliverChild method

  1. @override
bool hitTestSliverChild({
  1. required RenderSliver child,
  2. required Offset position,
  3. required Matrix4 transform,
  4. required bool checkBounds,
})
override

Hit tests a RenderSliver child at position with a transform.

Implementation

@override
bool hitTestSliverChild({
  required RenderSliver child,
  required Offset position,
  required Matrix4 transform,
  required bool checkBounds,
}) {
  final sliverResult = _SliverBoxyHitTestResult.wrap(hitTestResult!);
  return sliverResult.addWithPaintTransform(
    transform: transform,
    position: position,
    hitTest: (result, position) {
      if (checkBounds &&
          !(Offset.zero & child.hitTestSize).contains(position)) {
        return false;
      }
      final sliverPosition = wrapOffset(
        position,
        Size(
          child.constraints.crossAxisExtent,
          child.geometry!.layoutExtent,
        ).rotateWithAxis(child.constraints.axis),
      );
      return child.hitTest(
        SliverHitTestResult.wrap(result),
        crossAxisPosition: sliverPosition.cross,
        mainAxisPosition: sliverPosition.main,
      );
    },
  );
}