performLayout method
Hook for subclasses to perform layout within the given constraints.
Implementation
@override
Size performLayout(BoxConstraints constraints) {
final modal = widget as ModalOverlay;
final width = constraints.hasBoundedWidth
? constraints.maxWidth
: modal.width;
final height = constraints.hasBoundedHeight
? constraints.maxHeight
: modal.height;
if (childElement != null) {
childElement!.relativeOffset = Offset(
modal.dialogBounds.x + 1,
modal.dialogBounds.y + 1,
);
final childW = max(0, modal.dialogBounds.width - 2);
final childH = max(0, modal.dialogBounds.height - 2);
childElement!.layout(BoxConstraints.tight(Size(childW, childH)));
}
return constraints.constrain(Size(width, height));
}