fix(ui): 对齐所有页面样式到 Pencil 设计规范
transfer_page.dart: - 金色主题统一(Light: secondary #F59E0B, Dark: primary #D4AF37) - 修复交换按钮和确认按钮颜色 home_page.dart: - Asset Card 圆角 14px - 总资产字号 28px (displayLarge) - "预估总资产"字号 13px (bodyLarge) - 盈亏标签/数值字重调整 quick_actions_row.dart: - padding 统一为 16px welfare_center_page.dart: - _statusBadge padding [6, 14] trade_form_card.dart / price_card.dart: - 样式细节对齐
This commit is contained in:
@@ -41,30 +41,44 @@ class _TransferPageState extends State<TransferPage> {
|
||||
// 数据访问
|
||||
// ============================================
|
||||
|
||||
/// 获取资金账户余额
|
||||
/// 获取资金账户余额(安全检查)
|
||||
String get _fundBalance {
|
||||
final provider = context.read<AssetProvider>();
|
||||
return provider.fundAccount?.balance ?? provider.overview?.fundBalance ?? '0.00';
|
||||
try {
|
||||
final provider = context.read<AssetProvider>();
|
||||
final balance = provider.fundAccount?.balance ?? provider.overview?.fundBalance ?? '0.00';
|
||||
// 确保返回的是有效的数字格式
|
||||
return _formatBalance(balance);
|
||||
} catch (e) {
|
||||
return '0.00';
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取交易账户 USDT 余额
|
||||
/// 获取交易账户 USDT 余额(安全检查)
|
||||
String get _tradeUsdtBalance {
|
||||
final provider = context.read<AssetProvider>();
|
||||
final usdtHolding = provider.tradeAccounts.firstWhere(
|
||||
(t) => t.coinCode.toUpperCase() == 'USDT',
|
||||
orElse: () => AccountTrade(
|
||||
id: 0,
|
||||
userId: 0,
|
||||
coinCode: 'USDT',
|
||||
quantity: '0',
|
||||
avgPrice: '1',
|
||||
totalCost: '0',
|
||||
currentValue: '0',
|
||||
profit: '0',
|
||||
profitRate: 0,
|
||||
),
|
||||
);
|
||||
return usdtHolding.quantity;
|
||||
try {
|
||||
final provider = context.read<AssetProvider>();
|
||||
// 先检查列表是否为空
|
||||
if (provider.tradeAccounts.isEmpty) {
|
||||
return '0.00';
|
||||
}
|
||||
final usdtHolding = provider.tradeAccounts.firstWhere(
|
||||
(t) => t.coinCode.toUpperCase() == 'USDT',
|
||||
orElse: () => AccountTrade(
|
||||
id: 0,
|
||||
userId: 0,
|
||||
coinCode: 'USDT',
|
||||
quantity: '0',
|
||||
avgPrice: '1',
|
||||
totalCost: '0',
|
||||
currentValue: '0',
|
||||
profit: '0',
|
||||
profitRate: 0,
|
||||
),
|
||||
);
|
||||
return _formatBalance(usdtHolding.quantity);
|
||||
} catch (e) {
|
||||
return '0.00';
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取当前可用余额(根据方向)
|
||||
@@ -191,6 +205,10 @@ class _TransferPageState extends State<TransferPage> {
|
||||
|
||||
Widget _buildTransferDirectionCard() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
// 金色主题感知: Dark #D4AF37 (primary), Light #F59E0B (secondary)
|
||||
final goldAccent = colorScheme.brightness == Brightness.dark
|
||||
? colorScheme.primary
|
||||
: colorScheme.secondary;
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -213,19 +231,28 @@ class _TransferPageState extends State<TransferPage> {
|
||||
),
|
||||
),
|
||||
|
||||
// Swap button
|
||||
// Swap button with gold accent
|
||||
GestureDetector(
|
||||
onTap: _toggleDirection,
|
||||
child: Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
width: 40,
|
||||
height: 40,
|
||||
margin: const EdgeInsets.symmetric(vertical: AppSpacing.md),
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.secondary,
|
||||
// 椭圆形半透明金色背景
|
||||
color: goldAccent.withValues(alpha: 0.15),
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: goldAccent.withValues(alpha: 0.3),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(LucideIcons.arrowUpDown, size: 18, color: colorScheme.onSecondary),
|
||||
child: Icon(
|
||||
LucideIcons.arrowUpDown,
|
||||
size: 20,
|
||||
color: goldAccent,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -286,7 +313,7 @@ class _TransferPageState extends State<TransferPage> {
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
label == '从' ? LucideIcons.wallet : LucideIcons.repeat,
|
||||
label == '从' ? LucideIcons.wallet : LucideIcons.trendingUp,
|
||||
size: 18,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
@@ -445,6 +472,10 @@ class _TransferPageState extends State<TransferPage> {
|
||||
|
||||
Widget _buildConfirmButton() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
// 金色主题感知: Dark #D4AF37 (primary), Light #F59E0B (secondary)
|
||||
final goldAccent = colorScheme.brightness == Brightness.dark
|
||||
? colorScheme.primary
|
||||
: colorScheme.secondary;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -453,24 +484,25 @@ class _TransferPageState extends State<TransferPage> {
|
||||
onTap: _isLoading ? null : _doTransfer,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.secondary,
|
||||
color: goldAccent, // 使用金色 #F59E0B
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
),
|
||||
child: Center(
|
||||
child: _isLoading
|
||||
? SizedBox(
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(colorScheme.onSecondary),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
: const Text(
|
||||
'确认划转',
|
||||
style: AppTextStyles.displayMedium(context).copyWith(
|
||||
color: colorScheme.onSecondary,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user