calculateTotalColumns method

int calculateTotalColumns(
  1. double screenWidth
)

Calculates the total number of columns in the grid based on the screen width.

The screenWidth parameter represents the width of the screen. The total number of columns is determined by comparing the screen width with the provided breakpoints. Returns the total number of columns.

Implementation

int calculateTotalColumns(double screenWidth) {
  int totalColumns = 12;

  for (int i = 0; i < breakpoints.length; i++) {
    if (screenWidth < breakpoints[i]) {
      totalColumns = i + 1;
      break;
    }
  }

  return totalColumns;
}