setScreenSize static method

void setScreenSize(
  1. BoxConstraints constraints,
  2. Orientation currentOrientation
)

Sets the Screen's size and Device's Orientation, BoxConstraints, Height, and Width

Implementation

static void setScreenSize(
    BoxConstraints constraints, Orientation currentOrientation) {
  // Sets boxconstraints and orientation
  boxConstraints = constraints;
  orientation = currentOrientation;

  // Sets screen width and height
  width = boxConstraints.maxWidth;
  height = boxConstraints.maxHeight;

  // Sets ScreenType
  if ((orientation == Orientation.portrait && width < 600) ||
      (orientation == Orientation.landscape && height < 600)) {
    screenType = ScreenType.mobile;
  } else {
    screenType = ScreenType.tablet;
  }
}