hitTest method

  1. @override
bool hitTest(
  1. BoxHitTestResult result, {
  2. required Offset position,
})
override

Pressed where it is drawn: its box moved as far as it is drawn, and tested as any box is (a press off the box misses all of it).

Implementation

@override
bool hitTest(BoxHitTestResult result, {required Offset position}) {
  if (!((Offset.zero & size).shift(shift)).contains(position)) return false;
  if (!hitTestChildren(result, position: position)) return false;
  result.add(BoxHitTestEntry(this, position));
  return true;
}