forked from mgl_crew/Mitgliederladen
main #1
1 changed files with 10 additions and 4 deletions
|
@ -35,6 +35,12 @@ class Purchase {
|
||||||
Purchase(this.product, this.amount);
|
Purchase(this.product, this.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Basket {
|
||||||
|
List<Purchase> purchases;
|
||||||
|
int price;
|
||||||
|
Basket(this.purchases, this.price);
|
||||||
|
}
|
||||||
|
|
||||||
class ShowBasket extends StatelessWidget {
|
class ShowBasket extends StatelessWidget {
|
||||||
ShowBasket({super.key});
|
ShowBasket({super.key});
|
||||||
|
|
||||||
|
@ -49,7 +55,7 @@ class ShowBasket extends StatelessWidget {
|
||||||
Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien)
|
Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien)
|
||||||
];
|
];
|
||||||
|
|
||||||
final List<Purchase> basket = [
|
Basket basket = Basket([
|
||||||
Purchase(products[0], 20),
|
Purchase(products[0], 20),
|
||||||
Purchase(products[1], 2200),
|
Purchase(products[1], 2200),
|
||||||
Purchase(products[2], 2),
|
Purchase(products[2], 2),
|
||||||
|
@ -57,18 +63,18 @@ class ShowBasket extends StatelessWidget {
|
||||||
Purchase(products[4], 1),
|
Purchase(products[4], 1),
|
||||||
Purchase(products[5], 2),
|
Purchase(products[5], 2),
|
||||||
Purchase(products[6], 202)
|
Purchase(products[6], 202)
|
||||||
];
|
], 304);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: null,
|
itemCount: null,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index < basket.length) {
|
if (index < basket.purchases.length) {
|
||||||
return Card(
|
return Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.abc),
|
leading: const Icon(Icons.abc),
|
||||||
title: Text(basket[index].product.name),
|
title: Text(basket.purchases[index].product.name),
|
||||||
//trailing: Text(),
|
//trailing: Text(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue