byOrientation method

Size byOrientation(
  1. Orientation? orientation
)

Returns a Size with the width and height swapped for Orientation

Implementation

Size byOrientation(Orientation? orientation) {
  if (orientation == null) return this;
  switch (orientation) {
    case Orientation.portrait:
      return Size(shortestSide, longestSide);
    case Orientation.landscape:
      return Size(longestSide, shortestSide);
  }
}