feat: add equality operators, make history screen paginated, random performance updates

This commit is contained in:
2026-07-29 18:10:46 +02:00
parent da5588cd1c
commit 031a618220
22 changed files with 702 additions and 79 deletions
+12 -9
View File
@@ -88,9 +88,11 @@ class BarScreenViewModel extends ChangeNotifier {
throw Exception('Product is out of stock.');
}
await barTabService.addProductToTab(tabId: tab.id, product: product);
await inventory.decreaseStock(product.id, 1);
await barTabService.addProductToTab(
tabId: tab.id,
product: product,
stockAdjustment: () => inventory.decreaseStock(product.id, 1),
);
await _reloadTabs();
}
@@ -101,14 +103,15 @@ class BarScreenViewModel extends ChangeNotifier {
await barTabService.updateTabItemQuantity(
tabItemId: item.id,
quantity: quantity,
stockAdjustment: () async {
if (difference > 0) {
await inventory.decreaseStock(item.productId, difference);
} else if (difference < 0) {
await inventory.increaseStock(item.productId, -difference);
}
},
);
if (difference > 0) {
await inventory.decreaseStock(item.productId, difference);
} else if (difference < 0) {
await inventory.increaseStock(item.productId, -difference);
}
await _reloadTabs();
}