getCrossAxisCount function

int getCrossAxisCount(
  1. int itemCount
)

Implementation

int getCrossAxisCount(int itemCount) {
  if (itemCount == 3) {
    return 2;
  } else if (itemCount == 4 || itemCount == 5 || itemCount == 6) {
    return 2;
  } else if (itemCount == 7 || itemCount == 8 || itemCount == 9) {
    return 3;
  } else {
    return 3; // For more than 9 items, default to 3 columns
  }
}