import 'package:flutter/material.dart'; import 'package:thesis_shop/models/product.dart'; import 'package:thesis_shop/stores/cart_store.dart'; import 'package:thesis_shop/widgets/number_picker.dart'; class ProductItem extends StatelessWidget { final Product product; const ProductItem({Key? key, required this.product}) : super(key: key); @override Widget build(BuildContext context) { final cartStore = CartStore.of(context); return ListTile( title: Text('${product.title} (${product.priceAsString}€/Stück)'), trailing: NumberPicker( value: cartStore.amountOfProduct(product), onUp: () => cartStore.increaseAmount(product), onDown: () => cartStore.decreaseAmount(product), ), ); } }