getScreenWidth method
Implementation
double getScreenWidth() {
double widthCalc = useShortestSide
? (windowWidth < windowHeight ? windowWidth : windowHeight)
: windowWidth;
activeBreakpointSegment = getActiveBreakpointSegment(widthCalc);
// Special 0 width condition.
if (activeBreakpointSegment.responsiveBreakpoint.breakpoint == 0) return 0;
// Check if screenWidth exceeds maxWidth.
if (maxWidth != null && windowWidth > maxWidth!) {
// Check if there is an active breakpoint with autoScale set to true.
if (activeBreakpointSegment.breakpoint >= maxWidth! &&
activeBreakpointSegment.responsiveBreakpoint.isAutoScale) {
// Proportionally scaled width that exceeds maxWidth.
return maxWidth! +
(windowWidth -
activeBreakpointSegment.responsiveBreakpoint.breakpoint);
} else {
// Max Width reached. Return Max Width because no breakpoint is active.
return maxWidth!;
}
}
return windowWidth;
}