responsiveInsets static method

double responsiveInsets(
  1. double width, [
  2. bool isCompact = false
])

Responsive insets based on width.

The width may be from LayoutBuilder or MediaQuery, depending on what is appropriate for the use case.

Implementation

static double responsiveInsets(double width, [bool isCompact = false]) {
  if (width < phoneWidthBreakpoint || isCompact) return edgeInsetsPhone;
  if (width < desktopWidthBreakpoint) return edgeInsetsTablet;
  if (width < bigDesktopWidthBreakpoint) return edgeInsetsDesktop;
  return edgeInsetsBigDesktop;
}