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? subAmount; 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, this.subAmount, required this.date, this.statusTag, this.onTap, }); @override Widget build(BuildContext context) { final colors = Theme.of(context).extension()!; 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 (subAmount != null && subAmount!.isNotEmpty) ...[ const SizedBox(height: 2), Align( alignment: Alignment.centerRight, child: Text( subAmount!, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w700, color: Colors.green, ), ), ), ], 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.textSecondary), ), ), const SizedBox(width: 8), ?statusTag, ], ), ], ), ), ); } }