toRect method
Implementation
Rect toRect(Vector2 size, [Vector2 Function(Vector2 point)? projector]) {
final convert = projector ?? localToGlobal;
final topLeft = convert(Vector2.zero());
final bottomRight = convert(size);
if (_angle == 0.0 && _skew.isZero()) {
return Rect.fromPoints(topLeft.toOffset(), bottomRight.toOffset());
}
final topRight = convert(Vector2(size.x, 0));
final bottomLeft = convert(Vector2(0, size.y));
final xs = [topLeft.x, topRight.x, bottomLeft.x, bottomRight.x]..sort();
final ys = [topLeft.y, topRight.y, bottomLeft.y, bottomRight.y]..sort();
return Rect.fromLTRB(xs.first, ys.first, xs.last, ys.last);
}