update theme
This commit is contained in:
@@ -32,6 +32,8 @@ class InvoiceCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
final currencyFormatter = NumberFormat.currency(
|
||||
locale: 'vi_VN',
|
||||
symbol: 'đ',
|
||||
@@ -61,10 +63,10 @@ class InvoiceCard extends StatelessWidget {
|
||||
// Invoice number
|
||||
Text(
|
||||
'Mã hoá đơn #${invoice.invoiceNumber}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@@ -72,9 +74,9 @@ class InvoiceCard extends StatelessWidget {
|
||||
if (invoice.orderId != null)
|
||||
Text(
|
||||
'Đơn hàng: #${invoice.orderId}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -88,10 +90,18 @@ class InvoiceCard extends StatelessWidget {
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Invoice dates
|
||||
_buildDetailRow('Ngày hóa đơn:', _formatDate(invoice.issueDate)),
|
||||
_buildDetailRow(
|
||||
context,
|
||||
'Ngày hóa đơn:',
|
||||
_formatDate(invoice.issueDate),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
|
||||
_buildDetailRow('Hạn thanh toán:', _formatDate(invoice.dueDate)),
|
||||
_buildDetailRow(
|
||||
context,
|
||||
'Hạn thanh toán:',
|
||||
_formatDate(invoice.dueDate),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
@@ -99,13 +109,14 @@ class InvoiceCard extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.grey50,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 2,
|
||||
children: [
|
||||
_buildPaymentRow(
|
||||
context,
|
||||
'Tổng tiền:',
|
||||
currencyFormatter.format(invoice.totalAmount),
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -113,6 +124,7 @@ class InvoiceCard extends StatelessWidget {
|
||||
if (invoice.amountPaid > 0) ...[
|
||||
const SizedBox(height: 6),
|
||||
_buildPaymentRow(
|
||||
context,
|
||||
'Đã thanh toán:',
|
||||
currencyFormatter.format(invoice.amountPaid),
|
||||
valueColor: AppColors.success,
|
||||
@@ -122,6 +134,7 @@ class InvoiceCard extends StatelessWidget {
|
||||
if (invoice.amountRemaining > 0) ...[
|
||||
const SizedBox(height: 6),
|
||||
_buildPaymentRow(
|
||||
context,
|
||||
'Còn lại:',
|
||||
currencyFormatter.format(invoice.amountRemaining),
|
||||
valueColor: invoice.isOverdue
|
||||
@@ -137,7 +150,7 @@ class InvoiceCard extends StatelessWidget {
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Action button
|
||||
_buildActionButton(),
|
||||
_buildActionButton(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -146,7 +159,9 @@ class InvoiceCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// Build detail row
|
||||
Widget _buildDetailRow(String label, String value) {
|
||||
Widget _buildDetailRow(BuildContext context, String label, String value) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -154,14 +169,14 @@ class InvoiceCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 14, color: AppColors.grey500),
|
||||
style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -171,24 +186,27 @@ class InvoiceCard extends StatelessWidget {
|
||||
|
||||
/// Build payment summary row
|
||||
Widget _buildPaymentRow(
|
||||
BuildContext context,
|
||||
String label,
|
||||
String value, {
|
||||
Color? valueColor,
|
||||
FontWeight? fontWeight,
|
||||
}) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 13, color: AppColors.grey500),
|
||||
style: TextStyle(fontSize: 13, color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: fontWeight ?? FontWeight.w400,
|
||||
color: valueColor ?? AppColors.grey900,
|
||||
color: valueColor ?? colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -219,10 +237,11 @@ class InvoiceCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// Build action button
|
||||
Widget _buildActionButton() {
|
||||
Widget _buildActionButton(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isPaid = invoice.status == InvoiceStatus.paid || invoice.isPaid;
|
||||
final buttonText = isPaid ? 'Đã hoàn tất' : 'Thanh toán';
|
||||
final buttonColor = isPaid ? AppColors.success : AppColors.primaryBlue;
|
||||
final buttonColor = isPaid ? AppColors.success : colorScheme.primary;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -230,9 +249,9 @@ class InvoiceCard extends StatelessWidget {
|
||||
onPressed: isPaid ? null : onPaymentTap,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: buttonColor,
|
||||
disabledBackgroundColor: AppColors.grey100,
|
||||
foregroundColor: Colors.white,
|
||||
disabledForegroundColor: AppColors.grey500,
|
||||
disabledBackgroundColor: colorScheme.surfaceContainerHighest,
|
||||
foregroundColor: colorScheme.surface,
|
||||
disabledForegroundColor: colorScheme.onSurfaceVariant,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
elevation: 0,
|
||||
|
||||
Reference in New Issue
Block a user