| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import 'package:flutter/material.dart';
- import '../../core/theme/app_colors_extension.dart';
- /// Pencil Component/ListCard — 列表卡片(报销申请列表等)
- class ListCard extends StatelessWidget {
- final String cardNo;
- final String? applicant;
- final String? description;
- final String amount;
- final Color? amountColor;
- final String date;
- final Widget? statusTag;
- final VoidCallback? onTap;
- const ListCard({
- super.key,
- required this.cardNo,
- this.applicant,
- this.description,
- required this.amount,
- this.amountColor,
- required this.date,
- this.statusTag,
- this.onTap,
- });
- @override
- Widget build(BuildContext context) {
- final colors = Theme.of(context).extension<AppColorsExtension>()!;
- final desc = description ?? '';
- final sub = applicant ?? '';
- return GestureDetector(
- onTap: onTap,
- child: Container(
- padding: const EdgeInsets.all(12),
- decoration: BoxDecoration(color: colors.bgCard, borderRadius: BorderRadius.circular(8)),
- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
- Flexible(child: Text(cardNo, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: colors.textPrimary))),
- const SizedBox(width: 12),
- Text(amount, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: amountColor ?? colors.amountPrimary)),
- ]),
- if (sub.isNotEmpty) ...[
- const SizedBox(height: 4),
- Text(sub, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 13, color: colors.textSecondary)),
- ],
- if (desc.isNotEmpty) ...[
- const SizedBox(height: 4),
- Text(desc, maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 14, color: colors.textSecondary)),
- ],
- const SizedBox(height: 8),
- Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
- Flexible(child: Text(date, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 12, color: colors.textPlaceholder))),
- const SizedBox(width: 8),
- ?statusTag,
- ]),
- ]),
- ),
- );
- }
- }
|