getConstraintsForChild method

  1. @override
BoxConstraints getConstraintsForChild(
  1. BoxConstraints constraints
)
override

The constraints for the child given the incoming constraints.

During layout, the child is given the layout constraints returned by this function. The child is required to pick a size for itself that satisfies these constraints.

Defaults to the given constraints.

Implementation

@override
// BoxConstraints getConstraintsForChild(BoxConstraints constraints) =>  constraints.loosen();
// BoxConstraints getConstraintsForChild(BoxConstraints constraints) => BoxConstraints(maxWidth: _anchorSize.width, maxHeight: _anchorSize.height, minHeight: 64);
BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
  // Pass constraints with width from _size, and min/max height - child will size itself within these bounds
  return BoxConstraints(
    minWidth: _size.value.width,
    maxWidth: _size.value.width,
    minHeight: minHeight,
    maxHeight: maxHeight,
  );
}