isLargeScreen static method

bool isLargeScreen(
  1. BuildContext context
)

Point to note (Using an iPad 9.7" as a test case)

PROBLEM: Each time the orientation changes, the values of the width and height are recalculated automatically (MediaQuery.of(context).size.width & MediaQuery.of(context).size.height). So for devices like an IOS 9.7" iPad, the width of the tablet in portrait is 900. Since the smallScreenBreakPoint is 940, this makes the value of isSmallScreen(context) to be TRUE, which should not the case.

SOLUTION: To solve this, we use the max(a, b) function from dart to get the size of longest side of the device. This is then used to calculate the various values isSmallScreen, isMediumScreen and isLargeScreen regardless of the changes in orientation.

Also, the reason for the change from the initial 1280 to 1200 is that on the same iPad(9.7"), the value of the longest side evaluates to 1224. This makes the value of isLargeScreen to be FALSE even though the tablet is large enough show a large screen UI. Hence the change /// Large screen is any screen whose width is more than largeScreenBreakPoint pixels

Implementation

///  /// Large screen is any screen whose width is more than [largeScreenBreakPoint] pixels
static bool isLargeScreen(BuildContext context) {
  return MediaQuery.of(context).size.width >= smallScreenBreakPoint;
}