setAppSize static method

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

Implementation

static void setAppSize(
    BoxConstraints constraints, Orientation currentOrientation) {
  boxConstraints = constraints;
  orientation = currentOrientation;

  // Sets screen width and height
  if (orientation == Orientation.portrait) {
    w = boxConstraints.maxWidth;
    h = boxConstraints.maxHeight;
  } else {
    w = boxConstraints.maxHeight;
    h = boxConstraints.maxWidth;
  }

  // Sets ScreenType
  if (kIsWeb) {
    deviceType = DeviceType.web;
  } else if (Platform.isAndroid || Platform.isIOS) {
    if ((orientation == Orientation.portrait && w < 600) ||
        (orientation == Orientation.landscape && h < 600)) {
      deviceType = DeviceType.mobile;
    } else {
      deviceType = DeviceType.tablet;
    }
  } else if (Platform.isMacOS) {
    deviceType = DeviceType.mac;
  } else if (Platform.isWindows) {
    deviceType = DeviceType.windows;
  } else if (Platform.isLinux) {
    deviceType = DeviceType.linux;
  } else {
    deviceType = DeviceType.fuchsia;
  }
}