layout method
void
layout(
- Context context,
- BoxConstraints constraints, {
- bool parentUsesSize = false,
override
First widget pass to calculate the children layout and bounding box
Implementation
@override
void layout(Context context, BoxConstraints constraints,
{bool parentUsesSize = false}) {
_validateStructure();
if (children.isEmpty) {
_context.lastRow = _context.firstRow;
_layout = null;
_visible = null;
box = PdfRect.fromPoints(PdfPoint.zero, constraints.smallest);
return;
}
final resolved = _resolveCachedLayout(context, constraints);
_validateResolvedLayout(resolved);
_layout = resolved;
final visible = _resolveVisibleRows(resolved, constraints);
_visible = visible;
_context.lastRow = visible.nextRow;
_positionVisibleChildren(context, resolved, visible);
final width = resolved.widths.fold(0.0, (sum, width) => sum + width);
box = constraints.constrainRect(width: width, height: visible.totalHeight);
}