performBoxLayout method

  1. @override
void performBoxLayout(
  1. BoxConstraints constraints
)
override

Perform layout with typed box constraints

Subclasses override this instead of performLayout. The default implementation sizes to the maxima, treating an unbounded axis as the corresponding lower bound.

Implementation

@override
void performBoxLayout(BoxConstraints constraints) {
  final child = this.child;
  if (child != null) {
    child.layout(constraints);

    positionChild(child, 0, 0);

    size = Size(
      constraints.constrainWidth(child.width),
      constraints.constrainHeight(child.height),
    );
  } else {
    size = Size(
      constraints.constrainWidth(0),
      constraints.constrainHeight(0),
    );
  }
}