remove card from product page

This commit is contained in:
Mikkel Troels Kongsted 2025-03-06 11:42:13 +01:00
parent aefcac742b
commit 3339857580

View File

@ -17,10 +17,8 @@ class ProductPage extends StatelessWidget {
final AddToCartStateRepo addToCartStateRepo = final AddToCartStateRepo addToCartStateRepo =
context.watch<AddToCartStateRepo>(); context.watch<AddToCartStateRepo>();
return Scaffold( return Scaffold(
backgroundColor: Colors.white,
body: SafeArea( body: SafeArea(
child: Card(
color: Colors.white,
margin: const EdgeInsets.all(10),
child: Container( child: Container(
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
child: Column(children: [ child: Column(children: [
@ -57,8 +55,7 @@ class ProductPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Image( Image(
image: image: AssetImage("assets/products/${product.name}.png"),
AssetImage("assets/products/${product.name}.png"),
errorBuilder: (_, __, ___) => const Image( errorBuilder: (_, __, ___) => const Image(
image: AssetImage("assets/placeholder.png")), image: AssetImage("assets/placeholder.png")),
height: 250, height: 250,
@ -92,12 +89,10 @@ class ProductPage extends StatelessWidget {
'Tilføjet ${addToCartStateRepo.currentAmount} ${product.name} til kurven'), 'Tilføjet ${addToCartStateRepo.currentAmount} ${product.name} til kurven'),
duration: const Duration(seconds: 2), duration: const Duration(seconds: 2),
); );
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context).removeCurrentSnackBar();
.removeCurrentSnackBar();
final cartRepo = context.read<CartRepo>(); final cartRepo = context.read<CartRepo>();
cartRepo.addToCart(product); cartRepo.addToCart(product);
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context).showSnackBar(snackBar);
.showSnackBar(snackBar);
}, },
child: const Text("Tilføj til indkøbskurv")), child: const Text("Tilføj til indkøbskurv")),
], ],
@ -107,7 +102,6 @@ class ProductPage extends StatelessWidget {
]), ]),
), ),
), ),
),
); );
} }
} }