layoutPositionedChild static method
- RenderBox child,
- StackParentData childParentData,
- Size size,
- Alignment alignment,
Lays out the positioned child
according to alignment
within a Stack of size
.
Returns true when the child has visual overflow.
Implementation
static bool layoutPositionedChild(RenderBox child, StackParentData childParentData, Size size, Alignment alignment) {
assert(childParentData.isPositioned);
assert(child.parentData == childParentData);
final BoxConstraints childConstraints = childParentData.positionedChildConstraints(size);
child.layout(childConstraints, parentUsesSize: true);
final double x = switch (childParentData) {
StackParentData(:final double left?) => left,
StackParentData(:final double right?) => size.width - right - child.size.width,
StackParentData() => alignment.alongOffset(size - child.size as Offset).dx,
};
final double y = switch (childParentData) {
StackParentData(:final double top?) => top,
StackParentData(:final double bottom?) => size.height - bottom - child.size.height,
StackParentData() => alignment.alongOffset(size - child.size as Offset).dy,
};
childParentData.offset = Offset(x, y);
return x < 0.0 || x + child.size.width > size.width
|| y < 0.0 || y + child.size.height > size.height;
}