responsiveVisibility function

bool responsiveVisibility({
  1. required BuildContext context,
  2. bool phone = true,
  3. bool tablet = true,
  4. bool tabletLandscape = true,
  5. bool desktop = true,
})

Implementation

bool responsiveVisibility({
  required BuildContext context,
  bool phone = true,
  bool tablet = true,
  bool tabletLandscape = true,
  bool desktop = true,
}) {
  final width = MediaQuery.of(context).size.width;
  if (width < kMobileWidthCutoff) {
    return phone;
  } else if (width < 767) {
    return tablet;
  } else if (width < 991) {
    return tabletLandscape;
  } else {
    return desktop;
  }
}