fix: formatting

This commit is contained in:
2026-07-29 01:42:34 +02:00
parent 521c8f8c4e
commit 50e6fca9d1
32 changed files with 501 additions and 575 deletions
+8 -22
View File
@@ -6,9 +6,7 @@ import '../services/product_service.dart';
class InventoryViewModel extends ChangeNotifier {
final ProductService productService;
InventoryViewModel({
required this.productService,
});
InventoryViewModel({required this.productService});
List<Product> _products = [];
@@ -19,43 +17,31 @@ class InventoryViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> decreaseStock(
String productId,
int amount,
) async {
Future<void> decreaseStock(String productId, int amount) async {
await productService.decreaseStock(productId, amount);
final index = _products.indexWhere(
(product) => product.id == productId,
);
final index = _products.indexWhere((product) => product.id == productId);
if (index != -1) {
_products[index] = _products[index].copyWith(
stockQuantity:
_products[index].stockQuantity - amount,
stockQuantity: _products[index].stockQuantity - amount,
);
}
notifyListeners();
}
Future<void> increaseStock(
String productId,
int amount,
) async {
Future<void> increaseStock(String productId, int amount) async {
await productService.increaseStock(productId, amount);
final index = _products.indexWhere(
(product) => product.id == productId,
);
final index = _products.indexWhere((product) => product.id == productId);
if (index != -1) {
_products[index] = _products[index].copyWith(
stockQuantity:
_products[index].stockQuantity + amount,
stockQuantity: _products[index].stockQuantity + amount,
);
}
notifyListeners();
}
}
}