dvScreenClassFor function

DVScreenClass dvScreenClassFor(
  1. Size size, {
  2. bool television = false,
  3. bool watch = false,
})

The class of a screen of logical size.

Implementation

DVScreenClass dvScreenClassFor(Size size, {bool television = false, bool watch = false}) {
  final double shortest = size.shortestSide;
  if (watch || (shortest < 300 && size.longestSide < 400)) return DVScreenClass.watch;
  if (television) return DVScreenClass.tv;
  // No desktop runs a 2160-tall layout at 1x; a 4K panel at 1x is signage.
  if (shortest >= 1800) return DVScreenClass.billboard;
  if (size.width >= 1200) return DVScreenClass.desktop;
  if (shortest >= 600) return DVScreenClass.tablet;
  return DVScreenClass.phone;
}