setupParentData method

  1. @override
void setupParentData(
  1. covariant RenderBox child
)
override

Override to setup parent data correctly for your children.

You can call this function to set up the parent data for child before the child is added to the parent's child list.

Implementation

@override
void setupParentData(RenderBox child) {
  if (child.parentData is! FlexParentData) {
    child.parentData = BoxyFlexParentData();
  } else if (child.parentData is! BoxyFlexParentData) {
    final parentData = child.parentData! as FlexParentData;
    child.parentData = BoxyFlexParentData()
      ..flex = parentData.flex
      ..fit = parentData.fit;
  }
}