浏览代码

minor fixes

c90Beretta 1 月之前
父节点
当前提交
90ec430e5a
共有 1 个文件被更改,包括 17 次插入0 次删除
  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;
+  //   }
+  // }
+}