hitTest method

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

PRESSED WHERE IT IS DRAWN. The box keeps the place the stack gave it and the child is drawn at the mark, outside that box; Flutter asks a child only inside its parent's box, so a press on what was moved went to whatever lay under it. A recipe app's search field holds a scan icon laid out at the field's top and drawn 25px down at its middle, and every press on the icon went to the field. As a Transform is, the child is asked wherever it is drawn, and nothing else is hit.

Implementation

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