isLargerThan method
Is the scaledWidth larger than or equal to name
?
Defaults to false if the name
cannot be found.
Implementation
bool isLargerThan(String? name) {
// No breakpoints to match.
if (breakpoints.isEmpty) return false;
// Breakpoint is active breakpoint.
if (activeBreakpoint.name == name) return false;
// Single breakpoint is active and screen width
// is larger than default breakpoint.
if (breakpoints.length == 1 && screenWidth >= breakpoints[0].breakpoint) {
return true;
}
// Find first breakpoint end boundary that is larger
// than screen width. Breakpoint names could be
// chained so perform a full search from largest to smallest.
for (var i = breakpoints.length - 2; i >= 0; i--) {
if (breakpoints[i].name == name &&
breakpoints[i + 1].name != name &&
screenWidth >= breakpoints[i + 1].breakpoint) return true;
}
return false;
}