custom_card.dart 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import 'package:flutter/material.dart';
  2. class CustomProductCard extends StatelessWidget {
  3. final String? imageURL;
  4. final String? titulo;
  5. final String? precio;
  6. final int? cantidad;
  7. const CustomProductCard(
  8. {super.key,
  9. this.imageURL,
  10. required this.titulo,
  11. required this.precio,
  12. required this.cantidad});
  13. @override
  14. Widget build(BuildContext context) {
  15. return Container(
  16. padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
  17. decoration: BoxDecoration(
  18. color: Colors.white,
  19. borderRadius: BorderRadius.circular(10),
  20. ),
  21. child: Row(
  22. children: [
  23. // Imagen del producto
  24. ClipRRect(
  25. borderRadius: BorderRadius.circular(5),
  26. child: Image.network(
  27. 'https://picsum.photos/200/300?random=3',
  28. width: 80,
  29. height: 80,
  30. fit: BoxFit.cover,
  31. ),
  32. ),
  33. const SizedBox(width: 10),
  34. // Contenido del texto (título)
  35. Expanded(
  36. child: Column(
  37. crossAxisAlignment: CrossAxisAlignment.start,
  38. mainAxisSize: MainAxisSize.min,
  39. children: [
  40. Text(
  41. titulo ?? "Titulo Producto",
  42. softWrap: true,
  43. maxLines: 2,
  44. overflow: TextOverflow.ellipsis,
  45. style: const TextStyle(
  46. fontWeight: FontWeight.bold,
  47. fontSize: 14,
  48. color: Colors.black87,
  49. ),
  50. ),
  51. const SizedBox(height: 4),
  52. // Precio
  53. Row(
  54. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  55. mainAxisSize: MainAxisSize.max,
  56. children: [
  57. Text(
  58. '\$$precio',
  59. style: TextStyle(
  60. fontSize: 16,
  61. fontWeight: FontWeight.bold,
  62. color: Colors.green[700],
  63. ),
  64. ),
  65. Text(
  66. "${cantidad}x",
  67. style: TextStyle(
  68. fontSize: 16,
  69. fontWeight: FontWeight.w500,
  70. color: Colors.grey[600],
  71. ),
  72. ),
  73. ],
  74. ),
  75. ],
  76. ),
  77. ),
  78. // Cantidad
  79. ],
  80. ),
  81. );
  82. }
  83. }