52 lines
1.3 KiB
Dart
52 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ProductCard extends StatelessWidget {
|
|
final String name;
|
|
final double price;
|
|
final String image;
|
|
|
|
const ProductCard({
|
|
super.key,
|
|
required this.name,
|
|
required this.price,
|
|
required this.image,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: 150,
|
|
margin: const EdgeInsets.all(8.0),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(15),
|
|
boxShadow: const [
|
|
BoxShadow(color: Colors.black12, blurRadius: 4, offset: Offset(2, 2))
|
|
],
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Image.asset(image, height: 100),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(
|
|
name,
|
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
Text("\$${price.toStringAsFixed(2)}",
|
|
style: const TextStyle(color: Colors.green)),
|
|
ElevatedButton(
|
|
onPressed: () {},
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.green.shade600,
|
|
minimumSize: const Size(120, 35),
|
|
),
|
|
child: const Text("Add to Cart"),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|