performLayout method

  1. @override
void performLayout(
  1. Constraints constraints
)
override

Called to perform the actual layout computation for this render object.

Implementation

@override
void performLayout(Constraints constraints) {
  final boxConstraints = BoxConstraints.asBox(constraints);
  const edgeInsetsZero = EdgeInsets.zero;
  final totalMargin = margin ?? edgeInsetsZero;
  final totalPadding = padding ?? edgeInsetsZero;

  int containerW = _width ?? boxConstraints.maxWidth;
  int containerH = _height ?? LayoutConstants.defaultContainerHeight;

  if (child != null) {
    final resolved = _layoutChild(containerW, containerH, totalPadding);
    containerW = resolved.$1;
    containerH = resolved.$2;
  }

  size = Size(
    containerW + totalMargin.horizontal,
    containerH + totalMargin.vertical,
  );
}