import 'package:flutter/material.dart'; import '../models/product.dart'; class ProductCard extends StatelessWidget { final Product product; final VoidCallback onView; final VoidCallback onAddToCart; const ProductCard({ super.key, required this.product, required this.onView, required this.onAddToCart, }); @override Widget build(BuildContext context) { return Card( clipBehavior: Clip.antiAlias, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( child: Image.network( product.imageUrl, fit: BoxFit.cover, ), ), Padding( padding: const EdgeInsets.all(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( product.name, style: const TextStyle( fontWeight: FontWeight.w600, fontSize: 16, ), ), const SizedBox(height: 4), Text('\$${product.price.toStringAsFixed(2)}'), const SizedBox(height: 10), Row( children: [ Expanded( child: OutlinedButton( onPressed: onView, child: const Text('Details'), ), ), const SizedBox(width: 8), Expanded( child: FilledButton( onPressed: onAddToCart, child: const Text('Add'), ), ), ], ), ], ), ) ], ), ); } }