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) {
  Size buttonSize = position.toSize(constraints.biggest);

  double constraintsWidth = buttonSize.width;
  double constraintsHeight = max(
      position.top - buttonSize.height - padding.top - kToolbarHeight,
      constraints.biggest.height - position.top - padding.bottom);

  return BoxConstraints.loose(Size(constraintsWidth, constraintsHeight));
}