- 首页:移除盈亏日历,福利中心卡片改为白色背景,查看按钮改为黄色 - 资产页面:余额卡片撑满宽度 - 底部导航栏:移除背景高亮,只保留图标和文字变化 - 行情页面:调整卡片文字大小和柱形图样式 - 交易页面:买入按钮白色文字,卖出按钮红色文字,优化输入框和百分比卡片样式,添加顶部间距 - 全局:移除渐变色,统一使用纯色背景
79 lines
2.5 KiB
Dart
79 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../core/theme/app_theme.dart';
|
|
import '../../../../core/theme/app_theme_extension.dart';
|
|
import '../../../../core/theme/app_spacing.dart';
|
|
import '../../../../providers/asset_provider.dart';
|
|
import '../../../components/glass_panel.dart';
|
|
|
|
/// 余额卡片 — .pen node 59637
|
|
/// cornerRadius: lg, fill: $surface-card, padding: 20, stroke: $border-default 1px, gap: 12
|
|
/// balLabel: "USDT 余额" 12px normal $text-secondary
|
|
/// balAmount: "25,680.50" 28px w700 $text-primary
|
|
/// balSubRow: "≈ $25,680.50 USD" 12px normal $text-muted
|
|
class BalanceCard extends StatelessWidget {
|
|
final AssetProvider provider;
|
|
final int activeTab;
|
|
|
|
const BalanceCard({
|
|
super.key,
|
|
required this.provider,
|
|
required this.activeTab,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final displayBalance = activeTab == 0
|
|
? (provider.fundAccount?.balance ?? provider.overview?.fundBalance ?? '0.00')
|
|
: _calculateTradeTotal();
|
|
|
|
return SizedBox(
|
|
width: double.infinity, // 确保卡片撑满宽度
|
|
child: GlassPanel(
|
|
padding: const EdgeInsets.all(20),
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'USDT 余额',
|
|
style: AppTextStyles.bodyMedium(context).copyWith(
|
|
color: context.colors.onSurfaceVariant,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
_formatBalance(displayBalance),
|
|
style: AppTextStyles.numberLarge(context),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'\u2248 \$${_formatBalance(displayBalance)} USD',
|
|
style: AppTextStyles.bodyMedium(context).copyWith(
|
|
color: context.appColors.onSurfaceMuted,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String _calculateTradeTotal() {
|
|
double total = 0;
|
|
for (var h in provider.holdings) {
|
|
total += double.tryParse(h.currentValue?.toString() ?? '0') ?? 0;
|
|
}
|
|
return total.toStringAsFixed(2);
|
|
}
|
|
|
|
String _formatBalance(String balance) {
|
|
final d = double.tryParse(balance) ?? 0;
|
|
return d.toStringAsFixed(2).replaceAllMapped(
|
|
RegExp(r'\B(?=(\d{3})+(?!\d))'),
|
|
(Match m) => ',',
|
|
);
|
|
}
|
|
}
|