copyWithAxis method

BoxConstraints copyWithAxis(
  1. Axis axis, {
  2. double? minCross,
  3. double? maxCross,
  4. double? minMain,
  5. double? maxMain,
})

Creates a copy of this box constraints but with the given fields replaced with the new values.

Implementation

BoxConstraints copyWithAxis(Axis axis, {
  double? minCross,
  double? maxCross,
  double? minMain,
  double? maxMain,
}) {
  return axis == Axis.vertical ?
    copyWith(
      minWidth: minCross,
      maxWidth: maxCross,
      minHeight: minMain,
      maxHeight: maxMain,
    ) :
    copyWith(
      minWidth: minMain,
      maxWidth: maxMain,
      minHeight: minCross,
      maxHeight: maxCross,
    );
}