list_card.dart 2.9 KB

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