constrainAxis method
Returns the value that both satisfies the constraints and is as close as
possible to the given extent on axis.
Implementation
double constrainAxis(Axis axis, [double extent = double.infinity]) {
  return axis == Axis.vertical
      ? constrainHeight(extent)
      : constrainWidth(extent);
}