123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import 'package:flutter/material.dart';
- class CustomProductCard extends StatelessWidget {
- final String? imageURL;
- final String? titulo;
- final String? precio;
- final int? cantidad;
- const CustomProductCard(
- {super.key,
- this.imageURL,
- required this.titulo,
- required this.precio,
- required this.cantidad});
- @override
- Widget build(BuildContext context) {
- return Container(
- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10),
- ),
- child: Row(
- children: [
- // Imagen del producto
- ClipRRect(
- borderRadius: BorderRadius.circular(5),
- child: Image.network(
- 'https://picsum.photos/200/300?random=3',
- width: 80,
- height: 80,
- fit: BoxFit.cover,
- ),
- ),
- const SizedBox(width: 10),
- // Contenido del texto (título)
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- titulo ?? "Titulo Producto",
- softWrap: true,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 14,
- color: Colors.black87,
- ),
- ),
- const SizedBox(height: 4),
- // Precio
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- mainAxisSize: MainAxisSize.max,
- children: [
- Text(
- '\$$precio',
- style: TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.bold,
- color: Colors.green[700],
- ),
- ),
- Text(
- "${cantidad}x",
- style: TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- color: Colors.grey[600],
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- // Cantidad
- ],
- ),
- );
- }
- }
|