device method

Device device(
  1. double cx, [
  2. double? cy
])

Determines the type of the device based on the given coordinates.

Implementation

Device device(double cx, [double? cy]) {
  if (cx <= watch.width) {
    return watch;
  } else if (cx <= mobile.width) {
    return mobile;
  } else if (cx <= tablet.width) {
    return tablet;
  } else if (cx <= laptop.width) {
    return laptop;
  } else if (cx <= desktop.width) {
    return desktop;
  } else {
    return tv;
  }
}