list_card.dart 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import 'package:flutter/material.dart';
  2. import '../../core/theme/app_colors_extension.dart';
  3. /// Pencil Component/ListCard — 列表卡片(报销申请列表等)
  4. class ListCard extends StatelessWidget {
  5. final String cardNo;
  6. final String description;
  7. final String amount;
  8. final String date;
  9. final Widget? statusTag;
  10. final VoidCallback? onTap;
  11. const ListCard({
  12. super.key,
  13. required this.cardNo,
  14. required this.description,
  15. required this.amount,
  16. required this.date,
  17. this.statusTag,
  18. this.onTap,
  19. });
  20. @override
  21. Widget build(BuildContext context) {
  22. final colors = Theme.of(context).extension<AppColorsExtension>()!;
  23. return GestureDetector(
  24. onTap: onTap,
  25. child: Container(
  26. padding: const EdgeInsets.all(12),
  27. decoration: BoxDecoration(
  28. color: colors.bgCard,
  29. borderRadius: BorderRadius.circular(8),
  30. ),
  31. child: Column(
  32. crossAxisAlignment: CrossAxisAlignment.start,
  33. children: [
  34. Row(
  35. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  36. children: [
  37. Flexible(
  38. child: Text(
  39. cardNo,
  40. maxLines: 1,
  41. overflow: TextOverflow.ellipsis,
  42. style: TextStyle(
  43. fontSize: 14,
  44. fontWeight: FontWeight.w600,
  45. color: colors.textPrimary,
  46. ),
  47. ),
  48. ),
  49. const SizedBox(width: 12),
  50. Text(
  51. amount,
  52. maxLines: 1,
  53. overflow: TextOverflow.ellipsis,
  54. style: TextStyle(
  55. fontSize: 16,
  56. fontWeight: FontWeight.w700,
  57. color: colors.amountPrimary,
  58. ),
  59. ),
  60. ],
  61. ),
  62. const SizedBox(height: 8),
  63. Text(
  64. description,
  65. maxLines: 2,
  66. overflow: TextOverflow.ellipsis,
  67. style: TextStyle(
  68. fontSize: 14,
  69. color: colors.textSecondary,
  70. ),
  71. ),
  72. const SizedBox(height: 8),
  73. Row(
  74. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  75. children: [
  76. Flexible(
  77. child: Text(
  78. date,
  79. maxLines: 1,
  80. overflow: TextOverflow.ellipsis,
  81. style: TextStyle(
  82. fontSize: 12,
  83. color: colors.textPlaceholder,
  84. ),
  85. ),
  86. ),
  87. const SizedBox(width: 8),
  88. ?statusTag,
  89. ],
  90. ),
  91. ],
  92. ),
  93. ),
  94. );
  95. }
  96. }