deviceClass static method

String deviceClass(
  1. BuildContext context
)

Approximate device class based on screen width: 'phone', 'tablet' or 'desktop'.

Implementation

static String deviceClass(BuildContext context) {
  final double w = MediaQuery.sizeOf(context).width;
  if (w < 600) return 'phone';
  if (w < 1024) return 'tablet';
  return 'desktop';
}