render method
Renders the underlying widget to the provided buffer within the area.
Implementation
@override
void render(Buffer buffer, Rect area) {
final cb = widget as ConstrainedBox;
final clampedWidth = area.width.clamp(
cb.constraints.minWidth,
cb.constraints.maxWidth,
);
final clampedHeight = area.height.clamp(
cb.constraints.minHeight,
cb.constraints.maxHeight,
);
if (clampedWidth <= 0 || clampedHeight <= 0) return;
if (childElement != null &&
childElement!.widget.runtimeType == cb.child.runtimeType) {
childElement!.update(cb.child);
} else {
childElement = cb.child.createElement();
childElement!.mount(this);
}
final childArea = Rect(area.x, area.y, clampedWidth, clampedHeight);
final viewport = Viewport(buffer, childArea);
childElement!.render(viewport, Rect(0, 0, clampedWidth, clampedHeight));
}