getColumnCount static method

int getColumnCount(
  1. double width, {
  2. int mobileColumns = 2,
  3. int tabletColumns = 3,
  4. int desktopColumns = 4,
  5. int wideDesktopColumns = 5,
})

Returns the appropriate column count based on available width.

Implementation

static int getColumnCount(
  double width, {
  int mobileColumns = 2,
  int tabletColumns = 3,
  int desktopColumns = 4,
  int wideDesktopColumns = 5,
}) {
  if (width > 1400) return wideDesktopColumns;
  if (width > 1000) return desktopColumns;
  if (width > 600) return tabletColumns;
  return mobileColumns;
}