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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -525,6 +525,7 @@ class _AssetCardState extends State<_AssetCard> {
|
||||
|
||||
return GlassPanel(
|
||||
padding: EdgeInsets.all(20),
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg), // 14px
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -534,7 +535,7 @@ class _AssetCardState extends State<_AssetCard> {
|
||||
children: [
|
||||
Text(
|
||||
'预估总资产(USDT)',
|
||||
style: AppTextStyles.bodyMedium(context),
|
||||
style: AppTextStyles.bodyLarge(context), // 13px
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: widget.onDeposit,
|
||||
@@ -570,7 +571,7 @@ class _AssetCardState extends State<_AssetCard> {
|
||||
// 总资产金额
|
||||
Text(
|
||||
displayAsset,
|
||||
style: AppTextStyles.displaySmall(context).copyWith(
|
||||
style: AppTextStyles.displayLarge(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -1246,7 +1247,7 @@ class _ProfitStatCard extends StatelessWidget {
|
||||
Text(
|
||||
label,
|
||||
style: AppTextStyles.bodySmall(context).copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontWeight: FontWeight.w400, // w500 → w400
|
||||
color: color.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
@@ -1258,7 +1259,7 @@ class _ProfitStatCard extends StatelessWidget {
|
||||
? '${isProfit ? '+' : ''}${value!.toStringAsFixed(2)}'
|
||||
: '--',
|
||||
style: AppTextStyles.numberMedium(context).copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontWeight: FontWeight.w600, // bold → w600
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -34,7 +34,7 @@ class QuickActionsRow extends StatelessWidget {
|
||||
: const Color(0xFFE2E8F0);
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: AppSpacing.md, horizontal: AppSpacing.sm),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: containerBg,
|
||||
border: Border.all(
|
||||
|
||||
@@ -93,7 +93,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
|
||||
/// 状态胶囊标签
|
||||
Widget _statusBadge(String text, Color textColor, Color bgColor) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6), // [4,10] → [6,14]
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
@@ -223,6 +223,7 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
|
||||
Text(
|
||||
referralCode.isEmpty ? '暂无邀请码' : referralCode,
|
||||
style: AppTextStyles.displayMedium(context).copyWith(
|
||||
fontSize: 24, // 明确设置为 24px
|
||||
fontWeight: FontWeight.w800,
|
||||
color: goldAccent,
|
||||
letterSpacing: 2,
|
||||
@@ -444,7 +445,9 @@ class _WelfareCenterPageState extends State<WelfareCenterPage> {
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
username,
|
||||
style: AppTextStyles.headlineSmall(context),
|
||||
style: AppTextStyles.headlineSmall(context).copyWith(
|
||||
fontWeight: FontWeight.w500, // 添加 w500
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
|
||||
@@ -23,7 +23,7 @@ class PriceCard extends StatelessWidget {
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(AppSpacing.md + AppSpacing.sm),
|
||||
padding: const EdgeInsets.all(20), // 24px → 20px
|
||||
decoration: BoxDecoration(
|
||||
color: context.appColors.surfaceCard,
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
@@ -45,7 +45,7 @@ class PriceCard extends StatelessWidget {
|
||||
// 涨跌幅徽章 - 圆角sm,涨绿背景
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.sm, vertical: AppSpacing.xs),
|
||||
horizontal: 8, vertical: 4), // 调整 padding
|
||||
decoration: BoxDecoration(
|
||||
color: changeBgColor,
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
|
||||
@@ -207,7 +207,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHighest.withValues(alpha: 0.5),
|
||||
color: context.colors.surfaceContainerHighest, // 移除 0.5 透明度
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
),
|
||||
child: Center(
|
||||
|
||||
Reference in New Issue
Block a user