Fix: category colors and count elements

This commit is contained in:
2024-06-04 23:13:21 +03:00
parent 15105a7f33
commit 0170505376
4 changed files with 24 additions and 18 deletions

View File

@@ -109,13 +109,16 @@ class _BasketPageState extends State<BasketPage> {
}
void addItem(String id) async {
final item =
cartItems.firstWhere((element) => element.id == id, orElse: () {
final cartItem = gymCart.firstWhere((element) => element.id == id);
cartItem.localCount = 0;
return cartItem;
});
if (item.localCount + 1 > item.count) {
return;
}
setState(() {
final item =
cartItems.firstWhere((element) => element.id == id, orElse: () {
final cartItem = gymCart.firstWhere((element) => element.id == id);
cartItem.localCount = 0;
return cartItem;
});
item.localCount++;
cartItems[cartItems.indexOf(item)].localCount = item.localCount;
totalPrice =