calculateFixedChildSizes method
Implementation
Size calculateFixedChildSizes(ChildLayouter layoutChild) {
var allocatedWidth = 0.0;
var allocatedHeight = 0.0;
double maxChildExtent = _direction == Axis.horizontal
? constraints.maxWidth
: constraints.maxHeight;
//var idParent = model.id;
RenderBox? child = firstChild;
while (child != null) {
// perform layout
if (child.parentData is BoxData &&
(child.parentData as BoxData).model != null) {
var childData = (child.parentData as BoxData);
var childModel = childData.model!;
//var idChild = childModel.id;
// assign flex value
_setChildFlex(childData, childModel);
// layout child
if (childData.flex == null) {
// get layout constraints
var childConstraints =
_getChildLayoutConstraints(child, childModel, maxChildExtent);
// calculate the child's size by performing
// a dry layout. We use LocalBoxConstraints in order to
// override isTight, which is used in Layout() to determine if a
// child size change forces a parent to resize.
doLayout(child, childConstraints, layoutChild);
// set width
allocatedWidth = _direction == Axis.horizontal
? (allocatedWidth + (child.size.width))
: max(allocatedWidth, (child.size.width));
// set height
allocatedHeight = _direction == Axis.horizontal
? max(allocatedHeight, (child.size.height))
: allocatedHeight + (child.size.height);
}
}
// get next child
child = childAfter(child);
}
return Size(allocatedWidth, allocatedHeight);
}