hitTestChildren method
The child painted on top takes the press: paintOrder asked from its last, a box moved over the one after it hit first, as it is drawn.
Implementation
@override
bool hitTestChildren(BoxHitTestResult result, {required Offset position}) {
final order = paintOrder;
for (var i = order.length - 1; i >= 0; i--) {
final kid = order[i];
final data = kid.parentData! as InlineFlowParentData;
if (!data.shown) continue;
final hit = result.addWithPaintOffset(
offset: data.offset + data.shift,
position: position,
hitTest: (r, transformed) => kid.hitTest(r, position: transformed),
);
if (hit) return true;
}
return false;
}