applyParentData method
Applies the flex item 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 all the flex properties and attaches it to the child's ParentData.
The layout data includes sizing constraints, positioning offsets, flex factors, and alignment settings that the flex layout algorithm will use.
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.none,
paintOrder: paintOrder,
width: width,
height: height,
minWidth: minWidth,
maxWidth: maxWidth,
minHeight: minHeight,
maxHeight: maxHeight,
top: top,
left: left,
bottom: bottom,
right: right,
alignSelf: alignSelf,
aspectRatio: aspectRatio,
flexGrow: flexGrow,
flexShrink: flexShrink,
);
if (parentData.layoutData != newLayoutData) {
parentData.layoutData = newLayoutData;
parent.markNeedsLayout();
}
if (parentData.needLayoutBox != needLayoutBox) {
parentData.needLayoutBox = needLayoutBox;
parent.markNeedsLayout();
}
}