getCrossAxisCount function
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
}
}