From d97f1fbb1c2443e91623de4211b0473152d87ba0 Mon Sep 17 00:00:00 2001 From: esche Date: Fri, 23 Jun 2023 12:12:46 +0200 Subject: [PATCH] added price for basket --- Frontend-user/lib/basket.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Frontend-user/lib/basket.dart b/Frontend-user/lib/basket.dart index 1b11270..aef16b2 100644 --- a/Frontend-user/lib/basket.dart +++ b/Frontend-user/lib/basket.dart @@ -35,6 +35,12 @@ class Purchase { Purchase(this.product, this.amount); } +class Basket { + List purchases; + int price; + Basket(this.purchases, this.price); +} + class ShowBasket extends StatelessWidget { ShowBasket({super.key}); @@ -49,7 +55,7 @@ class ShowBasket extends StatelessWidget { Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien) ]; - final List basket = [ + Basket basket = Basket([ Purchase(products[0], 20), Purchase(products[1], 2200), Purchase(products[2], 2), @@ -57,18 +63,18 @@ class ShowBasket extends StatelessWidget { Purchase(products[4], 1), Purchase(products[5], 2), Purchase(products[6], 202) - ]; + ], 304); @override Widget build(BuildContext context) { return ListView.builder( itemCount: null, itemBuilder: (context, index) { - if (index < basket.length) { + if (index < basket.purchases.length) { return Card( child: ListTile( leading: const Icon(Icons.abc), - title: Text(basket[index].product.name), + title: Text(basket.purchases[index].product.name), //trailing: Text(), ), );