isScreenSize static method

bool isScreenSize(
  1. BuildContext context,
  2. ScreenSize size
)

Implementation

static bool isScreenSize(BuildContext context, ScreenSize size) {
  double screenWidth = MediaQuery.of(context).size.width;

  switch (size) {
    case ScreenSize.small:
      return screenWidth < 600;
    case ScreenSize.medium:
      return screenWidth >= 600 && screenWidth < 1200;
    case ScreenSize.big:
      return screenWidth >= 1200 && screenWidth < 1600;
    case ScreenSize.giant:
      return screenWidth >= 1600;
    default:
      return false;
  }
}