getResolution static method
Implementation
static Resolution getResolution({required BuildContext context}) {
double screenWidth = MediaQuery.of(context).size.width;
Resolution current = Resolution.mobile;
if (screenWidth <= 599) {
// Mobile
current = Resolution.mobile;
} else if (screenWidth >= 600 && screenWidth <= 959) {
// Tablet
current = Resolution.mobile;
} else if (screenWidth >= 960 && screenWidth <= 1279) {
// iPad
current = Resolution.ipad;
} else if (screenWidth >= 1280 && screenWidth <= 1439) {
// Small desktop
current = Resolution.desktop;
} else if (screenWidth >= 1440 && screenWidth <= 1919) {
// Medium desktop
current = Resolution.desktop;
} else {
// TV
current = Resolution.tv;
}
return current;
}