render method
Renders the underlying widget to the provided buffer within the area.
Implementation
@override
void render(Buffer buffer, Rect area) {
final row = widget as Row;
if (area.width <= 0 || area.height <= 0) return;
final constraints = row.children
.map((c) => _getConstraint(c, LayoutDirection.horizontal))
.toList();
final rects = splitRect(area, constraints, LayoutDirection.horizontal);
final newElements = <Element>[];
for (var i = 0; i < row.children.length; i++) {
final childWidget = row.children[i];
if (i < childElements.length &&
childElements[i].widget.runtimeType == childWidget.runtimeType) {
childElements[i].update(childWidget);
newElements.add(childElements[i]);
} else {
if (i < childElements.length) {
childElements[i].unmount();
}
final newEl = childWidget.createElement();
newEl.mount(this);
newElements.add(newEl);
}
}
for (var i = row.children.length; i < childElements.length; i++) {
childElements[i].unmount();
}
childElements = newElements;
for (var i = 0; i < childElements.length; i++) {
final childEl = childElements[i];
final childArea = rects[i];
final viewport = Viewport(buffer, childArea);
childEl.render(viewport, Rect(0, 0, childArea.width, childArea.height));
}
}