performLayout method
Called to perform the actual layout computation for this render object.
Implementation
@override
void performLayout(Constraints constraints) {
_cachedTitleWidth ??= stringWidth(title);
final int headerWidth = 2 + _cachedTitleWidth!;
const int headerH = 1;
int maxChildWidth = headerWidth;
int totalChildHeight = 0;
if (expanded) {
for (final child in children) {
child.layout(constraints);
final ExpansionTileParentData childData =
child.parentData as ExpansionTileParentData;
childData.offset = Offset(2, headerH + totalChildHeight);
maxChildWidth = math.max(maxChildWidth, child.size!.width);
totalChildHeight += child.size!.height;
}
}
final int childAndBorder = maxChildWidth + 2;
final int totalWidth = math.max(childAndBorder, headerWidth);
final int totalHeight = headerH + totalChildHeight;
size = Size(totalWidth, totalHeight);
}