resolveFor method

int resolveFor(
  1. double width
)

Resolves the active offset for a given layout width.

Uses a mobile-first approach where larger matching breakpoints take precedence.

Implementation

int resolveFor(double width) {
  int result = xs ?? 0;
  if (width >= BsBreakpoints.sm && sm != null) result = sm!;
  if (width >= BsBreakpoints.md && md != null) result = md!;
  if (width >= BsBreakpoints.lg && lg != null) result = lg!;
  if (width >= BsBreakpoints.xl && xl != null) result = xl!;
  if (width >= BsBreakpoints.xxl && xxl != null) result = xxl!;
  return result;
}