constrainAxisDimensions method
Returns the size that both satisfies the constraints and is as close as possible to the given cross and main size.
When you already have a Size, prefer constrain, which applies the same algorithm to a Size directly.
Implementation
Size constrainAxisDimensions(Axis axis, double cross, double main) {
return axis == Axis.vertical
? constrainDimensions(cross, main)
: constrainDimensions(main, cross);
}