applyParentData method
Applies the absolute positioning configuration to the child's parent data.
This method is called by the Flutter framework when the widget is inserted into the tree. It creates a LayoutData object with LayoutBehavior.absolute and attaches it to the child's ParentData.
The layout data includes positioning offsets, sizing constraints, and paint order that the layout algorithm will use for absolute positioning.
Implementation
@override
void applyParentData(RenderObject renderObject) {
assert(renderObject.parentData is LayoutBoxParentData);
final parentData = renderObject.parentData as LayoutBoxParentData;
final parent = renderObject.parent as RenderLayoutBox;
parentData.debugKey = key;
final newLayoutData = LayoutData(
behavior: LayoutBehavior.absolute,
paintOrder: paintOrder,
width: width,
height: height,
minWidth: minWidth,
maxWidth: maxWidth,
minHeight: minHeight,
maxHeight: maxHeight,
top: top,
left: left,
bottom: bottom,
right: right,
aspectRatio: aspectRatio,
flexGrow: 0.0,
flexShrink: 0.0,
);
if (parentData.layoutData != newLayoutData) {
parentData.layoutData = newLayoutData;
parent.markNeedsLayout();
}
if (parentData.needLayoutBox != needLayoutBox) {
parentData.needLayoutBox = needLayoutBox;
parent.markNeedsLayout();
}
}