Make a method that validates whether the pointer is outside the child or not. Then you can condition it inside your onTapUp event.
Something like this:
Get the Size of your child
final RenderBox childRenderBox = _childKey.currentContext.findRenderObject() as RenderBox;
final Size childSize = childRenderBox.size;
Convert the child's local coordinate sytem to the global coordinate system in logical pixels
final Offset childPosition = childRenderBox.localToGlobal(Offset.zero);
Check whether the touchPosition(Pointer) is outside of the child or box
return touchPosition.dx < childPosition.dx ||
touchPosition.dx > childPosition.dx + childSize.width ||
touchPosition.dy < childPosition.dy ||
touchPosition.dy > childPosition.dy + childSize.height;
Finally, you have a method that checks whether the pointer is outside or not.
bool _isOutsideChildBox(Offset touchPosition) {
final RenderBox childRenderBox =
_childKey.currentContext.findRenderObject() as RenderBox;
final Size childSize = childRenderBox.size;
final Offset childPosition = childRenderBox.localToGlobal(Offset.zero);
return touchPosition.dx < childPosition.dx ||
touchPosition.dx > childPosition.dx + childSize.width ||
touchPosition.dy < childPosition.dy ||
touchPosition.dy > childPosition.dy + childSize.height;
}
Now on your onTapUp event check whether the touch's position is outside or not then do something out of it.
void _onTapUp(PointerUpEvent event) {
if(_isOutSideChildBox(event.position)){
dont emit release...
}
}