forked from mgl_crew/Mitgliederladen
added price for basket
This commit is contained in:
parent
6c19b77768
commit
d97f1fbb1c
1 changed files with 10 additions and 4 deletions
|
@ -35,6 +35,12 @@ class Purchase {
|
|||
Purchase(this.product, this.amount);
|
||||
}
|
||||
|
||||
class Basket {
|
||||
List<Purchase> 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<Purchase> 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(),
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue