minimumSizeFor method
Implementation
@override
DiagramSize minimumSizeFor(
FramedElement shape,
Map<String, double> textHeights,
) {
var fixed = 0.0, flex = 0.0, unit = 0.0, cross = 0.0, count = 0;
for (final child in children) {
final size = child.minimumSizeFor(shape, textHeights);
if (_main(size) == 0 && _cross(size) == 0) continue;
count++;
cross = math.max(cross, _cross(size));
if (child is ShapeSized && child.extent != null) {
fixed += child.extent!;
} else if (child is ShapeSized &&
(child.textHeightSlot != null || child.contentHeightSlot != null)) {
fixed += _main(size);
} else {
final weight = child is ShapeSized ? child.flex : 1.0;
flex += weight;
unit = math.max(unit, _main(size) / weight);
}
}
final main = fixed + flex * unit + gap * math.max(0, count - 1);
return horizontal ? DiagramSize(main, cross) : DiagramSize(cross, main);
}