Nav apraksta

custom_info_card.dart 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import 'package:flutter/material.dart';
  2. class CustomInfoCard extends StatelessWidget {
  3. final String imagePath;
  4. final String title;
  5. final String subtitle;
  6. const CustomInfoCard({
  7. super.key,
  8. required this.imagePath,
  9. required this.title,
  10. required this.subtitle,
  11. });
  12. @override
  13. Widget build(BuildContext context) {
  14. return SizedBox(
  15. width: double.infinity, // Takes full width of parent
  16. height: 130, // Fixed height, adjust as needed
  17. child: Card(
  18. margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
  19. shape: RoundedRectangleBorder(
  20. borderRadius: BorderRadius.circular(30),
  21. ),
  22. color: const Color.fromARGB(255, 254, 242, 221),
  23. child: Padding(
  24. padding: const EdgeInsets.only(right: 8),
  25. child: Row(
  26. children: [
  27. Container(
  28. width: 90, // Fixed width to match the height (110 - 16 * 2)
  29. height: 90,
  30. decoration: BoxDecoration(
  31. color: Colors.white,
  32. borderRadius: BorderRadius.circular(36),
  33. ),
  34. child: ClipRRect(
  35. borderRadius: BorderRadius.circular(36),
  36. child: Image.asset(
  37. imagePath,
  38. fit: BoxFit.cover,
  39. width: 90,
  40. height: 90,
  41. ),
  42. ),
  43. ),
  44. const SizedBox(width: 16),
  45. Expanded(
  46. child: Column(
  47. mainAxisAlignment: MainAxisAlignment.center,
  48. crossAxisAlignment: CrossAxisAlignment.start,
  49. children: [
  50. Text(
  51. title,
  52. style: const TextStyle(
  53. fontSize: 16,
  54. fontWeight: FontWeight.bold,
  55. ),
  56. ),
  57. const SizedBox(height: 4),
  58. Text(
  59. subtitle,
  60. style: TextStyle(
  61. fontSize: 14,
  62. color: Colors.grey[600],
  63. ),
  64. ),
  65. ],
  66. ),
  67. ),
  68. ],
  69. ),
  70. ),
  71. ),
  72. );
  73. }
  74. }