centerRect function
Returns a new Rectangle centered within area with width and height.
Upstream: CenterRect in third_party/ultraviolet/layout.go.
Implementation
Rectangle centerRect(Rectangle area, int width, int height) {
final centerX = area.minX + area.width ~/ 2;
final centerY = area.minY + area.height ~/ 2;
final minX = centerX - width ~/ 2;
final minY = centerY - height ~/ 2;
return rect(minX, minY, width, height);
}