rectCollision property
Rect
get
rectCollision
Implementation
Rect get rectCollision {
if (_rectCollision == null) {
var list = children.query<ShapeHitbox>();
if (list.isNotEmpty) {
_rectCollision = list.fold(
list.first.toRect(),
(previousValue, element) {
return previousValue!.expandToInclude(element.toRect());
},
);
}
}
var absoluteRect = toAbsoluteRect();
if (_rectCollision != null) {
return _rectCollision!.translate(absoluteRect.left, absoluteRect.top);
} else {
return absoluteRect;
}
}