You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @rohan20 , very useful repo about the above use case.
I’m using a similar use case only a brief change on products_list_page if I'm not wrong.
The current condition will show only an even number of products but if the category have only one product or an odd number of products like 9,11 ect… will lose one product.
I’ve add the following conditions as a workaround in order to show all products inside the condition else if (index % 2 == 0).
} else if (index % 2 == 0) {
// if we have odd number of products 7,9,11 ect show the last one
if (index == model.getProductsCount() - 1) {
return ProductsListItem(
product1: model.productsList[index],
product2: null,
);
// if we have only one product
} else if ( model.getProductsCount() == 1) {
return ProductsListItem(
product1: model.productsList[0],
product2: null,
);
} else {
//2nd, 4th, 6th.. index would contain nothing since this would
//be handled by the odd indexes where the row contains 2 items
return Container();
}
}
Thanks for sharing the repo! :)
The text was updated successfully, but these errors were encountered:
Hi @rohan20 , very useful repo about the above use case.
I’m using a similar use case only a brief change on products_list_page if I'm not wrong.
The current condition will show only an even number of products but if the category have only one product or an odd number of products like 9,11 ect… will lose one product.
I’ve add the following conditions as a workaround in order to show all products inside the condition else if (index % 2 == 0).
Thanks for sharing the repo! :)
The text was updated successfully, but these errors were encountered: