|
@@ -0,0 +1,17 @@
|
|
|
|
+import 'package:flutter/material.dart';
|
|
|
|
+import 'package:turquessa_mesas_hoster/core/models/producto_model.dart';
|
|
|
|
+
|
|
|
|
+class CarritoViewModel extends ChangeNotifier {
|
|
|
|
+ List<Producto> _productos = [];
|
|
|
|
+ int _cantidad = 0;
|
|
|
|
+
|
|
|
|
+ List<Producto> get productos => _productos;
|
|
|
|
+ int get cantidad => _cantidad;
|
|
|
|
+
|
|
|
|
+ // void agregarCarrito(Producto producto) {
|
|
|
|
+ // int index = _productos.indexWhere((item) => item.id == producto.id);
|
|
|
|
+ // if (index >= 0) {
|
|
|
|
+ // _productos[index].cantidad += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+}
|