deviceFromWeight static method

LayoutDevice deviceFromWeight(
  1. double w
)

Generates a LayoutDevice by maxWidth of BoxConstraints.

Implementation

// TODO: withFloatingWindow shouldn't return [LayoutDevice.web].
static LayoutDevice deviceFromWeight(double w) {
  if (w <= widthMobile) return LayoutDevice.mobile;
  if (w <= widthTablet) return LayoutDevice.tablet;
  if (w <= widthFullHD || w <= widthFloatingWindow) {
    return LayoutDevice.web;
  }

  if (w <= widthFullHDPlus) return LayoutDevice.webHD;

  // Could be any.
  return LayoutDevice.mobile;
}