c90Beretta hace 1 mes
padre
commit
90ec430e5a
Se han modificado 1 ficheros con 17 adiciones y 0 borrados
  1. 17 0
      lib/mvvm/viewmodels/carrito_view_model.dart

+ 17 - 0
lib/mvvm/viewmodels/carrito_view_model.dart

@@ -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;
+  //   }
+  // }
+}