deviceType property

DeviceType deviceType

deviceType

represent the current device type based on its frame width

Implementation

DeviceType get deviceType {
  /// if device with less than LayoutBreakPoint.kXsBreakPoint
  if (deviceWidth > 0 && deviceWidth < LayoutBreakPoint.kXsBreakPoint) {
    return DeviceType.smartphone;

    /// if device with less than LayoutBreakPoint.kSmBreakPoint
  } else if (deviceWidth >= LayoutBreakPoint.kXsBreakPoint &&
      deviceWidth < LayoutBreakPoint.kSmBreakPoint) {
    return DeviceType.miniTablet;

    /// if device with less than LayoutBreakPoint.kMdBreakPoint
  } else if (deviceWidth >= LayoutBreakPoint.kSmBreakPoint &&
      deviceWidth < LayoutBreakPoint.kMdBreakPoint) {
    return DeviceType.tablet;

    /// if device with larger than LayoutBreakPoint.kMdBreakPoint
  } else if (deviceWidth >= LayoutBreakPoint.kMdBreakPoint) {
    return DeviceType.desktop;

    /// if device with larger than LayoutBreakPoint.kLgBreakPoint
  } else if (deviceWidth >= LayoutBreakPoint.kLgBreakPoint) {
    return DeviceType.desktop;

    /// can be negative number
  } else {
    return DeviceType.unknown;
  }
}