mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-28 00:34:06 +02:00
remove card from product page
This commit is contained in:
parent
aefcac742b
commit
3339857580
@ -17,95 +17,89 @@ 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(
|
child: Container(
|
||||||
color: Colors.white,
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
margin: const EdgeInsets.all(10),
|
child: Column(children: [
|
||||||
child: Container(
|
Row(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
children: [
|
||||||
child: Column(children: [
|
Row(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
const BackButton(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
const BackButton(),
|
children: [
|
||||||
Column(
|
Text(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
product.name,
|
||||||
children: [
|
style: const TextStyle(
|
||||||
Text(
|
fontSize: 20,
|
||||||
product.name,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
formatDkkCents(product.priceInDkkCents),
|
Text(
|
||||||
style: const TextStyle(
|
formatDkkCents(product.priceInDkkCents),
|
||||||
fontSize: 16,
|
style: const TextStyle(
|
||||||
),
|
fontSize: 16,
|
||||||
)
|
),
|
||||||
])
|
)
|
||||||
],
|
])
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
Expanded(
|
),
|
||||||
child: Container(
|
Expanded(
|
||||||
padding: const EdgeInsets.all(20),
|
child: Container(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(20),
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
Image(
|
children: [
|
||||||
image:
|
Image(
|
||||||
AssetImage("assets/products/${product.name}.png"),
|
image: 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,
|
||||||
fit: BoxFit.fitHeight,
|
fit: BoxFit.fitHeight,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
product.name,
|
product.name,
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
formatDkkCents(product.priceInDkkCents),
|
formatDkkCents(product.priceInDkkCents),
|
||||||
style: Theme.of(context).textTheme.bodyLarge,
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 20, bottom: 20),
|
padding: const EdgeInsets.only(top: 20, bottom: 20),
|
||||||
child: Text(product.description),
|
child: Text(product.description),
|
||||||
),
|
),
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).push(MaterialPageRoute(
|
Navigator.of(context).push(MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
ProductLocationPage(product: product)));
|
ProductLocationPage(product: product)));
|
||||||
},
|
},
|
||||||
child: const Text("Find i butik")),
|
child: const Text("Find i butik")),
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final snackBarDuration = const Duration(seconds: 2);
|
final snackBarDuration = const Duration(seconds: 2);
|
||||||
addToCartStateRepo.notify(snackBarDuration);
|
addToCartStateRepo.notify(snackBarDuration);
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
'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).showSnackBar(snackBar);
|
||||||
ScaffoldMessenger.of(context)
|
},
|
||||||
.showSnackBar(snackBar);
|
child: const Text("Tilføj til indkøbskurv")),
|
||||||
},
|
],
|
||||||
child: const Text("Tilføj til indkøbskurv")),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
),
|
||||||
),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user