getBounds method
Gets the bounding box of all nodes
Implementation
Rect getBounds() {
if (nodes.isEmpty) return Rect.zero;
double minX = double.infinity;
double minY = double.infinity;
double maxX = double.negativeInfinity;
double maxY = double.negativeInfinity;
for (final node in nodes) {
final bounds = node.getBounds();
minX = minX < bounds.left ? minX : bounds.left;
minY = minY < bounds.top ? minY : bounds.top;
maxX = maxX > bounds.right ? maxX : bounds.right;
maxY = maxY > bounds.bottom ? maxY : bounds.bottom;
}
return Rect.fromLTRB(minX, minY, maxX, maxY);
}