feat(theme): update color scheme with new Slate theme and improved surface hierarchy
Updated the app's color scheme to implement a new "Slate" theme with refined dark and light variants. Changed background colors from #0A0E14 to #0B1120 for dark mode and updated surface layer colors to follow Material Design 3 specifications. Modified text colors and outline variants for better contrast and accessibility. Updated font sizes in transaction details screen from 11px to 12px for improved readability.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../core/theme/app_color_scheme.dart';
|
||||
import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/theme/app_theme.dart' show AppRadius;
|
||||
import '../../../core/utils/toast_utils.dart';
|
||||
import '../../../core/event/app_event_bus.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
@@ -21,10 +25,6 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
int _activeTab = 0; // 0=全部, 1=充值, 2=提现
|
||||
StreamSubscription<AppEvent>? _eventSub;
|
||||
|
||||
// 颜色常量
|
||||
static const upColor = Color(0xFF00C853);
|
||||
static const downColor = Color(0xFFFF5252);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -54,44 +54,83 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ShadTheme.of(context);
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final bgColor = isDark
|
||||
? AppColorScheme.darkBackground
|
||||
: AppColorScheme.lightBackground;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.colorScheme.background,
|
||||
backgroundColor: bgColor,
|
||||
appBar: AppBar(
|
||||
title: const Text('充提记录'),
|
||||
backgroundColor: theme.colorScheme.background,
|
||||
leading: IconButton(
|
||||
icon: const Icon(LucideIcons.arrowLeft, size: 20),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
title: Text(
|
||||
'充提记录',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
backgroundColor: bgColor,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_buildTabs(),
|
||||
Expanded(child: _buildOrderList()),
|
||||
_buildFilterTabs(context, isDark),
|
||||
Expanded(child: _buildOrderList(context, isDark)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTabs() {
|
||||
final theme = ShadTheme.of(context);
|
||||
// ---------------------------------------------------------------------------
|
||||
// Filter Tabs - pill-style segmented control
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildFilterTabs(BuildContext context, bool isDark) {
|
||||
final bgColor = isDark
|
||||
? AppColorScheme.darkSurfaceContainerHigh
|
||||
: AppColorScheme.lightSurfaceHigh;
|
||||
final activeBgColor = isDark
|
||||
? AppColorScheme.darkOnSurface
|
||||
: Colors.white;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildTab('全部', 0),
|
||||
const SizedBox(width: 12),
|
||||
_buildTab('充值', 1),
|
||||
const SizedBox(width: 12),
|
||||
_buildTab('提现', 2),
|
||||
],
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: const EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: AppRadius.radiusMd,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildPillTab('全部', 0, activeBgColor, isDark),
|
||||
_buildPillTab('充值', 1, activeBgColor, isDark),
|
||||
_buildPillTab('提现', 2, activeBgColor, isDark),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTab(String label, int index) {
|
||||
final theme = ShadTheme.of(context);
|
||||
Widget _buildPillTab(
|
||||
String label,
|
||||
int index,
|
||||
Color activeBgColor,
|
||||
bool isDark,
|
||||
) {
|
||||
final isActive = _activeTab == index;
|
||||
final activeTextColor = isDark
|
||||
? AppColorScheme.darkBackground
|
||||
: AppColorScheme.lightOnSurface;
|
||||
final inactiveTextColor = isDark
|
||||
? AppColorScheme.darkOnSurfaceVariant
|
||||
: AppColorScheme.lightOnSurfaceVariant;
|
||||
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
@@ -102,20 +141,17 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isActive ? theme.colorScheme.primary : theme.colorScheme.card,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: isActive ? theme.colorScheme.primary : theme.colorScheme.border,
|
||||
),
|
||||
color: isActive ? activeBgColor : Colors.transparent,
|
||||
borderRadius: AppRadius.radiusSm,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: isActive ? Colors.white : theme.colorScheme.mutedForeground,
|
||||
fontWeight: isActive ? FontWeight.w600 : FontWeight.normal,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: isActive ? FontWeight.w600 : FontWeight.w500,
|
||||
color: isActive ? activeTextColor : inactiveTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -124,7 +160,10 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderList() {
|
||||
// ---------------------------------------------------------------------------
|
||||
// Order List
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildOrderList(BuildContext context, bool isDark) {
|
||||
return Consumer<AssetProvider>(
|
||||
builder: (context, provider, _) {
|
||||
final orders = provider.fundOrders;
|
||||
@@ -142,12 +181,19 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
Icon(
|
||||
LucideIcons.inbox,
|
||||
size: 64,
|
||||
color: Colors.grey[400],
|
||||
color: isDark
|
||||
? AppColorScheme.darkOnSurfaceMuted
|
||||
: AppColorScheme.lightOnSurfaceMuted,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'暂无订单记录',
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
color: isDark
|
||||
? AppColorScheme.darkOnSurfaceVariant
|
||||
: AppColorScheme.lightOnSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -157,11 +203,11 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async => _loadData(),
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
|
||||
itemCount: orders.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildOrderCard(orders[index]);
|
||||
return _buildOrderCard(orders[index], isDark);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -169,190 +215,392 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderCard(OrderFund order) {
|
||||
final theme = ShadTheme.of(context);
|
||||
final isDeposit = order.isDeposit;
|
||||
// ---------------------------------------------------------------------------
|
||||
// Order Card
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildOrderCard(OrderFund order, bool isDark) {
|
||||
final cardBg = isDark
|
||||
? AppColorScheme.darkSurfaceContainer
|
||||
: AppColorScheme.lightSurfaceLowest;
|
||||
final borderColor = isDark
|
||||
? AppColorScheme.darkOutlineVariant.withValues(alpha: 0.15)
|
||||
: AppColorScheme.lightOutlineVariant.withValues(alpha: 0.5);
|
||||
final primaryText = isDark
|
||||
? AppColorScheme.darkOnSurface
|
||||
: AppColorScheme.lightOnSurface;
|
||||
final mutedText = isDark
|
||||
? AppColorScheme.darkOnSurfaceMuted
|
||||
: AppColorScheme.lightOnSurfaceMuted;
|
||||
|
||||
return ShadCard(
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: cardBg,
|
||||
borderRadius: AppRadius.radiusLg,
|
||||
border: Border.all(color: borderColor, width: 1),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: isDeposit
|
||||
? upColor.withValues(alpha: 0.1)
|
||||
: downColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
order.typeText,
|
||||
style: TextStyle(
|
||||
color: isDeposit ? upColor : downColor,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildStatusBadge(order),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
order.orderNo,
|
||||
style: const TextStyle(fontSize: 11, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Header: type badge + status badge
|
||||
_buildCardHeader(order, isDark),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'${isDeposit ? '+' : '-'}${order.amount} USDT',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isDeposit ? upColor : downColor,
|
||||
),
|
||||
),
|
||||
if (order.canCancel || order.canConfirmPay)
|
||||
Row(
|
||||
children: [
|
||||
if (order.canConfirmPay)
|
||||
ShadButton.outline(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _confirmPay(order),
|
||||
child: const Text('已打款'),
|
||||
),
|
||||
if (order.canCancel) ...[
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.destructive(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _cancelOrder(order),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
// Amount
|
||||
_buildAmountRow(order, primaryText),
|
||||
const SizedBox(height: 12),
|
||||
// 显示地址信息
|
||||
if (order.walletAddress != null) ...[
|
||||
const Divider(),
|
||||
// Detail rows
|
||||
_buildDetailRows(order, primaryText, mutedText),
|
||||
// Rejection reason
|
||||
if (order.rejectReason != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'${isDeposit ? '充值地址' : '提现地址'}: ',
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
order.walletAddress!,
|
||||
style: const TextStyle(fontSize: 11, fontFamily: 'monospace'),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: order.walletAddress!));
|
||||
ToastUtils.show('地址已复制');
|
||||
},
|
||||
child: Icon(LucideIcons.copy, size: 14, color: Colors.grey[600]),
|
||||
),
|
||||
],
|
||||
),
|
||||
_buildRejectionReason(order),
|
||||
],
|
||||
if (order.withdrawContact != null) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'联系方式: ${order.withdrawContact}',
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
// Payable amount (withdrawal with fee)
|
||||
if (order.receivableAmount != null && !order.isDeposit) ...[
|
||||
const SizedBox(height: 8),
|
||||
_buildPayableRow(order, isDark, primaryText),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
// Action buttons
|
||||
if (order.canCancel || order.canConfirmPay) ...[
|
||||
const SizedBox(height: 12),
|
||||
_buildActions(order, isDark),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Card Header - type badge + status badge
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildCardHeader(OrderFund order, bool isDark) {
|
||||
final upColor = AppColorScheme.getUpColor(isDark);
|
||||
final downColor = AppColorScheme.getDownColor(isDark);
|
||||
final upBg = AppColorScheme.getUpBackgroundColor(isDark, opacity: 0.12);
|
||||
final downBg = AppColorScheme.getDownBackgroundColor(isDark, opacity: 0.12);
|
||||
final typeColor = order.isDeposit ? upColor : downColor;
|
||||
final typeBg = order.isDeposit ? upBg : downBg;
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Type badge (充值 / 提现)
|
||||
_buildBadge(order.typeText, typeColor, typeBg),
|
||||
// Status badge
|
||||
_buildStatusBadge(order, isDark),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusBadge(OrderFund order, bool isDark) {
|
||||
final upColor = AppColorScheme.getUpColor(isDark);
|
||||
final downColor = AppColorScheme.getDownColor(isDark);
|
||||
final upBg = AppColorScheme.getUpBackgroundColor(isDark, opacity: 0.12);
|
||||
final downBg = AppColorScheme.getDownBackgroundColor(isDark, opacity: 0.12);
|
||||
const amberColor = Color(0xFFD97706);
|
||||
const amberBg = Color(0xFFFEF3C7);
|
||||
|
||||
Color bgColor;
|
||||
Color textColor;
|
||||
|
||||
if (order.isDeposit) {
|
||||
switch (order.status) {
|
||||
case 1: // 待付款
|
||||
case 2: // 待确认
|
||||
bgColor = amberBg;
|
||||
textColor = amberColor;
|
||||
break;
|
||||
case 3: // 已完成
|
||||
bgColor = upBg;
|
||||
textColor = upColor;
|
||||
break;
|
||||
default: // 已驳回/已取消
|
||||
bgColor = downBg;
|
||||
textColor = downColor;
|
||||
}
|
||||
} else {
|
||||
switch (order.status) {
|
||||
case 1: // 待审批
|
||||
case 5: // 待财务审核
|
||||
bgColor = amberBg;
|
||||
textColor = amberColor;
|
||||
break;
|
||||
case 2: // 已完成
|
||||
bgColor = upBg;
|
||||
textColor = upColor;
|
||||
break;
|
||||
default: // 已驳回/已取消
|
||||
bgColor = downBg;
|
||||
textColor = downColor;
|
||||
}
|
||||
}
|
||||
|
||||
return _buildBadge(order.statusText, textColor, bgColor);
|
||||
}
|
||||
|
||||
Widget _buildBadge(String text, Color textColor, Color bgColor) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Amount Row
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildAmountRow(OrderFund order, Color primaryText) {
|
||||
return Text(
|
||||
'${order.isDeposit ? '+' : '-'}${order.amount} USDT',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: primaryText,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Detail Rows
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildDetailRows(
|
||||
OrderFund order,
|
||||
Color primaryText,
|
||||
Color mutedText,
|
||||
) {
|
||||
return Column(
|
||||
children: [
|
||||
// Order number
|
||||
_buildDetailRow('订单号', order.orderNo, primaryText, mutedText),
|
||||
const SizedBox(height: 6),
|
||||
// Network / wallet address
|
||||
if (order.walletAddress != null) ...[
|
||||
_buildDetailRow(
|
||||
'网络',
|
||||
order.remark.isNotEmpty ? order.remark : '-',
|
||||
primaryText,
|
||||
mutedText,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildDetailRow(
|
||||
'地址',
|
||||
_truncateAddress(order.walletAddress!),
|
||||
primaryText,
|
||||
mutedText,
|
||||
trailing: GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: order.walletAddress!));
|
||||
ToastUtils.show('地址已复制');
|
||||
},
|
||||
child: Icon(
|
||||
LucideIcons.copy,
|
||||
size: 14,
|
||||
color: mutedText,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
] else if (order.remark.isNotEmpty) ...[
|
||||
_buildDetailRow('网络', order.remark, primaryText, mutedText),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
// Fee (withdrawal)
|
||||
if (order.fee != null && !order.isDeposit) ...[
|
||||
_buildDetailRow('手续费', '${order.fee}%', primaryText, mutedText),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
// Time
|
||||
_buildDetailRow(
|
||||
'时间',
|
||||
_formatTime(order.createTime),
|
||||
primaryText,
|
||||
mutedText,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailRow(
|
||||
String label,
|
||||
String value,
|
||||
Color primaryText,
|
||||
Color mutedText, {
|
||||
Widget? trailing,
|
||||
}) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: mutedText,
|
||||
),
|
||||
),
|
||||
if (trailing != null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'创建: ${_formatTime(order.createTime)}',
|
||||
style: const TextStyle(fontSize: 11, color: Colors.grey),
|
||||
),
|
||||
if (order.rejectReason != null)
|
||||
Expanded(
|
||||
child: Text(
|
||||
'驳回: ${order.rejectReason}',
|
||||
style: const TextStyle(fontSize: 11, color: downColor),
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
value,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: primaryText,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
trailing,
|
||||
],
|
||||
)
|
||||
else
|
||||
Text(
|
||||
value,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: primaryText,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Rejection Reason
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildRejectionReason(OrderFund order) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return Text(
|
||||
'拒绝原因: ${order.rejectReason}',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColorScheme.getDownColor(isDark),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Payable Amount Row (withdrawal)
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildPayableRow(
|
||||
OrderFund order,
|
||||
bool isDark,
|
||||
Color primaryText,
|
||||
) {
|
||||
final bgTertiary = isDark
|
||||
? AppColorScheme.darkSurfaceContainerHigh
|
||||
: AppColorScheme.lightSurfaceHigh;
|
||||
final secondaryText = isDark
|
||||
? AppColorScheme.darkOnSurfaceVariant
|
||||
: AppColorScheme.lightOnSurfaceVariant;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: bgTertiary,
|
||||
borderRadius: AppRadius.radiusSm,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'应付金额',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: secondaryText,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${order.receivableAmount} USDT',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: primaryText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusBadge(OrderFund order) {
|
||||
Color bgColor;
|
||||
Color textColor;
|
||||
// ---------------------------------------------------------------------------
|
||||
// Action Buttons
|
||||
// ---------------------------------------------------------------------------
|
||||
Widget _buildActions(OrderFund order, bool isDark) {
|
||||
final upColor = AppColorScheme.getUpColor(isDark);
|
||||
final downColor = AppColorScheme.getDownColor(isDark);
|
||||
|
||||
// 根据类型和状态设置颜色
|
||||
if (order.type == 1) {
|
||||
// 充值状态
|
||||
switch (order.status) {
|
||||
case 1: // 待付款
|
||||
case 2: // 待确认
|
||||
bgColor = Colors.orange.withValues(alpha: 0.1);
|
||||
textColor = Colors.orange;
|
||||
break;
|
||||
case 3: // 已完成
|
||||
bgColor = upColor.withValues(alpha: 0.1);
|
||||
textColor = upColor;
|
||||
break;
|
||||
default: // 已驳回/已取消
|
||||
bgColor = downColor.withValues(alpha: 0.1);
|
||||
textColor = downColor;
|
||||
}
|
||||
} else {
|
||||
// 提现状态
|
||||
switch (order.status) {
|
||||
case 1: // 待审批
|
||||
bgColor = Colors.orange.withValues(alpha: 0.1);
|
||||
textColor = Colors.orange;
|
||||
break;
|
||||
case 2: // 已完成
|
||||
bgColor = upColor.withValues(alpha: 0.1);
|
||||
textColor = upColor;
|
||||
break;
|
||||
default: // 已驳回/已取消
|
||||
bgColor = downColor.withValues(alpha: 0.1);
|
||||
textColor = downColor;
|
||||
}
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
order.statusText,
|
||||
style: TextStyle(fontSize: 11, color: textColor),
|
||||
),
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (order.canCancel)
|
||||
GestureDetector(
|
||||
onTap: () => _cancelOrder(order),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppRadius.radiusSm,
|
||||
border: Border.all(color: downColor, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
'取消订单',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: downColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (order.canCancel && order.canConfirmPay)
|
||||
const SizedBox(width: 12),
|
||||
if (order.canConfirmPay)
|
||||
GestureDetector(
|
||||
onTap: () => _confirmPay(order),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: upColor,
|
||||
borderRadius: AppRadius.radiusSm,
|
||||
),
|
||||
child: Text(
|
||||
'已打款',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
String _truncateAddress(String address) {
|
||||
if (address.length > 12) {
|
||||
return '${address.substring(0, 4)}...${address.substring(address.length - 4)}';
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
String _formatTime(DateTime? time) {
|
||||
if (time == null) return '-';
|
||||
return '${time.year}-${time.month.toString().padLeft(2, '0')}-${time.day.toString().padLeft(2, '0')} '
|
||||
@@ -360,60 +608,58 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
}
|
||||
|
||||
void _confirmPay(OrderFund order) async {
|
||||
final confirmed = await showShadDialog<bool>(
|
||||
final confirmed = await showShadConfirmDialog(
|
||||
context: context,
|
||||
builder: (context) => ShadDialog.alert(
|
||||
title: const Text('确认已打款'),
|
||||
description: const Text('确认您已完成向指定地址的转账?'),
|
||||
actions: [
|
||||
ShadButton.outline(
|
||||
child: const Text('取消'),
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
),
|
||||
ShadButton(
|
||||
child: const Text('确认'),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '确认已打款',
|
||||
description: '确认您已完成向指定地址的转账?',
|
||||
);
|
||||
|
||||
if (confirmed == true && mounted) {
|
||||
final response = await context.read<AssetProvider>().confirmPay(order.orderNo);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(response.success ? '确认成功,请等待审核' : response.message ?? '确认失败')),
|
||||
);
|
||||
BotToast.showText(text: response.success ? '确认成功,请等待审核' : response.message ?? '确认失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _cancelOrder(OrderFund order) async {
|
||||
final confirmed = await showShadDialog<bool>(
|
||||
final confirmed = await showShadConfirmDialog(
|
||||
context: context,
|
||||
builder: (context) => ShadDialog.alert(
|
||||
title: const Text('取消订单'),
|
||||
description: Text('确定要取消订单 ${order.orderNo} 吗?'),
|
||||
actions: [
|
||||
ShadButton.outline(
|
||||
child: const Text('返回'),
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
),
|
||||
ShadButton.destructive(
|
||||
child: const Text('确定取消'),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '取消订单',
|
||||
description: '确定要取消订单 ${order.orderNo} 吗?',
|
||||
destructive: true,
|
||||
);
|
||||
|
||||
if (confirmed == true && mounted) {
|
||||
final response = await context.read<AssetProvider>().cancelOrder(order.orderNo);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(response.success ? '订单已取消' : response.message ?? '取消失败')),
|
||||
);
|
||||
BotToast.showText(text: response.success ? '订单已取消' : response.message ?? '取消失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool?> showShadConfirmDialog({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
required String description,
|
||||
bool destructive = false,
|
||||
}) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(description),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('取消'),
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
),
|
||||
TextButton(
|
||||
child: Text(destructive ? '确定取消' : '确认'),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user