feat(ui): 优化所有页面使用现代设计系统

- 使用 AppSpacing 替换硬编码间距
- 使用 AppRadius 替换硬编码圆角
- 使用 withValues(alpha:) 替换 withOpacity
- 优化 login_page, home_page, market_page, trade_page, asset_page, mine_page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 15:37:59 +08:00
parent 51b2f30a1b
commit b40c9f8360
7 changed files with 172 additions and 162 deletions

View File

@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:provider/provider.dart';
import '../../../core/constants/app_colors.dart';
import '../../../core/theme/app_color_scheme.dart';
import '../../../core/theme/app_spacing.dart';
import '../../../data/models/coin.dart';
import '../../../providers/market_provider.dart';
@@ -60,7 +62,7 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
final theme = ShadTheme.of(context);
return Padding(
padding: const EdgeInsets.all(16),
padding: AppSpacing.pagePadding,
child: ShadInput(
controller: _searchController,
placeholder: const Text('搜索币种...'),
@@ -98,7 +100,7 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
return Container(
height: 44,
margin: const EdgeInsets.fromLTRB(16, 0, 16, 16),
margin: EdgeInsets.fromLTRB(AppSpacing.md, 0, AppSpacing.md, AppSpacing.md),
child: Row(
children: tabs.asMap().entries.map((entry) {
final index = entry.key;
@@ -108,13 +110,13 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
return GestureDetector(
onTap: () => provider.setTab(tab['key']!),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
margin: const EdgeInsets.only(right: 8),
padding: EdgeInsets.symmetric(horizontal: AppSpacing.lg + AppSpacing.xs, vertical: AppSpacing.sm + AppSpacing.xs),
margin: EdgeInsets.only(right: AppSpacing.sm),
decoration: BoxDecoration(
color: isActive
? theme.colorScheme.primary
: theme.colorScheme.card,
borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(AppRadius.xl),
),
child: Text(
tab['label']!,
@@ -153,12 +155,12 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
size: 48,
color: theme.colorScheme.destructive,
),
const SizedBox(height: 12),
SizedBox(height: AppSpacing.sm + AppSpacing.xs),
Text(
provider.error!,
style: TextStyle(color: theme.colorScheme.destructive),
),
const SizedBox(height: 16),
SizedBox(height: AppSpacing.md),
ShadButton(
onPressed: provider.loadCoins,
child: const Text('重试'),
@@ -179,7 +181,7 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
size: 48,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(height: 12),
SizedBox(height: AppSpacing.sm + AppSpacing.xs),
Text(
'暂无数据',
style: theme.textTheme.muted,
@@ -193,7 +195,7 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
onRefresh: provider.refresh,
color: theme.colorScheme.primary,
child: ListView.builder(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
padding: EdgeInsets.fromLTRB(AppSpacing.md, 0, AppSpacing.md, AppSpacing.md),
itemCount: coins.length,
itemBuilder: (context, index) => _buildCoinItem(coins[index]),
),
@@ -204,9 +206,9 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
final theme = ShadTheme.of(context);
return Padding(
padding: const EdgeInsets.only(bottom: 8),
padding: EdgeInsets.only(bottom: AppSpacing.sm),
child: ShadCard(
padding: const EdgeInsets.all(16),
padding: AppSpacing.cardPadding,
child: Row(
children: [
// 图标
@@ -221,7 +223,7 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
),
),
),
const SizedBox(width: 12),
SizedBox(width: AppSpacing.sm + AppSpacing.xs),
// 名称
Expanded(
child: Column(
@@ -242,15 +244,15 @@ class _MarketPageState extends State<MarketPage> with AutomaticKeepAliveClientMi
),
// 涨跌幅
Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
padding: EdgeInsets.symmetric(horizontal: AppSpacing.sm + AppSpacing.xs, vertical: AppSpacing.xs + AppSpacing.xs),
decoration: BoxDecoration(
color: AppColors.getChangeBackgroundColor(coin.isUp),
borderRadius: BorderRadius.circular(6),
color: getChangeBackgroundColor(coin.isUp),
borderRadius: BorderRadius.circular(AppRadius.sm + AppSpacing.xs),
),
child: Text(
coin.formattedChange,
style: TextStyle(
color: AppColors.getChangeColor(coin.isUp),
color: getChangeColor(coin.isUp),
fontWeight: FontWeight.w600,
),
),