refactor(ui): 移除快捷操作栏盈亏按钮,今日盈亏/总盈亏卡片已有点击跳转

This commit is contained in:
2026-04-06 03:15:32 +08:00
parent 773f699986
commit cc4d36d374
90 changed files with 60025 additions and 59835 deletions

View File

@@ -60,7 +60,7 @@ class AccountTabSwitcher extends StatelessWidget {
decoration: BoxDecoration(
color: isSelected
? context.colors.surface
: const Color(0x00000000),
: Colors.transparent,
borderRadius: BorderRadius.circular(AppRadius.sm),
boxShadow: isSelected
? [

View File

@@ -135,7 +135,7 @@ void showDepositDialog(BuildContext context) {
showShadDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: const Color(0x00000000),
backgroundColor: Colors.transparent,
child: GlassPanel(
borderRadius: BorderRadius.circular(AppRadius.lg),
padding: const EdgeInsets.all(AppSpacing.lg),
@@ -251,7 +251,7 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
showShadDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: const Color(0x00000000),
backgroundColor: Colors.transparent,
child: GlassPanel(
borderRadius: BorderRadius.circular(AppRadius.lg),
padding: const EdgeInsets.all(AppSpacing.lg),
@@ -365,7 +365,7 @@ void showWithdrawDialog(BuildContext context, String? balance) {
showShadDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: const Color(0x00000000),
backgroundColor: Colors.transparent,
child: GlassPanel(
borderRadius: BorderRadius.circular(AppRadius.lg),
padding: const EdgeInsets.all(AppSpacing.lg),
@@ -544,7 +544,7 @@ void showResultDialog(BuildContext context, String title, String? message) {
showShadDialog(
context: context,
builder: (ctx) => Dialog(
backgroundColor: const Color(0x00000000),
backgroundColor: Colors.transparent,
child: GlassPanel(
borderRadius: BorderRadius.circular(AppRadius.lg),
padding: const EdgeInsets.all(AppSpacing.lg),

View File

@@ -21,6 +21,7 @@ import '../mine/welfare_center_page.dart';
import 'header_bar.dart';
import 'quick_actions_row.dart';
import 'hot_coins_section.dart';
import 'profit_analysis_page.dart';
/// 首页
class HomePage extends StatefulWidget {
@@ -118,7 +119,6 @@ class _HomePageState extends State<HomePage>
onDeposit: _showDeposit,
onWithdraw: () => _navigateToAssetPage(),
onTransfer: () => _navigateToAssetPage(),
onProfit: () {},
onBills: () => _navigateToAssetPage(),
),
SizedBox(height: AppSpacing.md),
@@ -433,7 +433,6 @@ class _AssetCard extends StatefulWidget {
}
class _AssetCardState extends State<_AssetCard> {
bool _calendarExpanded = false;
late DateTime _currentMonth;
Map<String, dynamic>? _profitData;
bool _isLoadingCalendar = false;
@@ -451,13 +450,6 @@ class _AssetCardState extends State<_AssetCard> {
return double.tryParse(v) ?? 0;
}
Future<void> _toggleCalendar() async {
setState(() => _calendarExpanded = !_calendarExpanded);
if (_calendarExpanded && _profitData == null) {
await _loadProfit();
}
}
Future<void> _loadProfit() async {
setState(() => _isLoadingCalendar = true);
try {
@@ -584,7 +576,7 @@ class _AssetCardState extends State<_AssetCard> {
),
SizedBox(height: AppSpacing.md),
// 盈亏统计区:今日盈亏 | 总盈亏 + 盈亏分析按钮
// 盈亏统计区:今日盈亏 | 总盈亏
Row(
children: [
// 今日盈亏卡片
@@ -594,6 +586,10 @@ class _AssetCardState extends State<_AssetCard> {
value: _todayProfit,
upColor: upColor,
downColor: downColor,
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const ProfitAnalysisPage()),
),
),
),
SizedBox(width: AppSpacing.sm),
@@ -604,72 +600,17 @@ class _AssetCardState extends State<_AssetCard> {
value: _totalProfit,
upColor: upColor,
downColor: downColor,
),
),
SizedBox(width: AppSpacing.sm),
// 盈亏分析按钮
GestureDetector(
onTap: _toggleCalendar,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: _calendarExpanded
? context.colors.primary.withValues(alpha: 0.1)
: context.colors.surfaceContainerHigh,
borderRadius: BorderRadius.circular(AppRadius.full),
border: _calendarExpanded
? Border.all(color: context.colors.primary.withValues(alpha: 0.2))
: null,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
LucideIcons.chartBar,
size: 13,
color: _calendarExpanded
? context.colors.primary
: context.colors.onSurfaceVariant,
),
SizedBox(width: AppSpacing.xs),
Text(
'盈亏分析',
style: AppTextStyles.labelMedium(context).copyWith(
fontWeight: _calendarExpanded ? FontWeight.w600 : FontWeight.w500,
color: _calendarExpanded
? context.colors.primary
: context.colors.onSurfaceVariant,
),
),
SizedBox(width: 2),
AnimatedRotation(
turns: _calendarExpanded ? 0.5 : 0,
duration: const Duration(milliseconds: 200),
child: Icon(
LucideIcons.chevronDown,
size: 13,
color: _calendarExpanded
? context.colors.primary
: context.colors.onSurfaceVariant,
),
),
],
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (_) => const ProfitAnalysisPage()),
),
),
),
],
),
// 可折叠的盈利日历
AnimatedCrossFade(
firstChild: const SizedBox.shrink(),
secondChild: _buildCalendarSection(context),
crossFadeState: _calendarExpanded
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: const Duration(milliseconds: 300),
sizeCurve: Curves.easeInOut,
),
// 盈利日历
_buildCalendarSection(context),
],
),
);
@@ -964,7 +905,7 @@ class _WelfareCard extends StatelessWidget {
Container(
padding: EdgeInsets.symmetric(horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: AppColorScheme.darkError,
color: context.appColors.down,
borderRadius: BorderRadius.circular(AppRadius.md),
),
child: Text(
@@ -972,7 +913,7 @@ class _WelfareCard extends StatelessWidget {
style: AppTextStyles.bodySmall(context).copyWith(
fontSize: 10,
fontWeight: FontWeight.bold,
color: AppColorScheme.darkOnPrimary,
color: context.colors.onPrimary,
),
),
),
@@ -1257,12 +1198,14 @@ class _ProfitStatCard extends StatelessWidget {
final double? value;
final Color upColor;
final Color downColor;
final VoidCallback? onTap;
const _ProfitStatCard({
required this.label,
required this.value,
required this.upColor,
required this.downColor,
this.onTap,
});
@override
@@ -1271,52 +1214,56 @@ class _ProfitStatCard extends StatelessWidget {
final isProfit = (value ?? 0) >= 0;
final color = hasValue ? (isProfit ? upColor : downColor) : context.colors.onSurfaceVariant;
return Container(
padding: EdgeInsets.symmetric(horizontal: AppSpacing.md, vertical: AppSpacing.sm + 2),
decoration: BoxDecoration(
color: hasValue
? (isProfit ? upColor : downColor).withValues(alpha: 0.06)
: context.colors.surfaceContainerHigh.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Container(
padding: EdgeInsets.symmetric(horizontal: AppSpacing.md, vertical: AppSpacing.sm + 2),
decoration: BoxDecoration(
color: hasValue
? (isProfit ? upColor : downColor).withValues(alpha: 0.12)
: context.colors.outlineVariant.withValues(alpha: 0.1),
? (isProfit ? upColor : downColor).withValues(alpha: 0.06)
: context.colors.surfaceContainerHigh.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(AppRadius.lg),
border: Border.all(
color: hasValue
? (isProfit ? upColor : downColor).withValues(alpha: 0.12)
: context.colors.outlineVariant.withValues(alpha: 0.1),
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
hasValue
? (isProfit ? LucideIcons.trendingUp : LucideIcons.trendingDown)
: LucideIcons.minus,
size: 11,
color: color.withValues(alpha: 0.7),
),
SizedBox(width: 3),
Text(
label,
style: AppTextStyles.bodySmall(context).copyWith(
fontWeight: FontWeight.w500,
color: color.withValues(alpha: 0.8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
hasValue
? (isProfit ? LucideIcons.trendingUp : LucideIcons.trendingDown)
: LucideIcons.minus,
size: 11,
color: color.withValues(alpha: 0.7),
),
),
],
),
SizedBox(height: AppSpacing.xs),
Text(
hasValue
? '${isProfit ? '+' : ''}${value!.toStringAsFixed(2)}'
: '--',
style: AppTextStyles.numberMedium(context).copyWith(
fontWeight: FontWeight.bold,
color: color,
SizedBox(width: 3),
Text(
label,
style: AppTextStyles.bodySmall(context).copyWith(
fontWeight: FontWeight.w500,
color: color.withValues(alpha: 0.8),
),
),
],
),
),
],
SizedBox(height: AppSpacing.xs),
Text(
hasValue
? '${isProfit ? '+' : ''}${value!.toStringAsFixed(2)}'
: '--',
style: AppTextStyles.numberMedium(context).copyWith(
fontWeight: FontWeight.bold,
color: color,
),
),
],
),
),
);
}

View File

@@ -3,21 +3,19 @@ import 'package:shadcn_ui/shadcn_ui.dart';
import '../../../core/theme/app_theme.dart';
import '../../../core/theme/app_spacing.dart';
/// 首页快捷操作栏 - 充值/提现/划转/盈亏/账单
/// 首页快捷操作栏 - 充值/提现/划转/账单
class QuickActionsRow extends StatelessWidget {
const QuickActionsRow({
super.key,
this.onDeposit,
this.onWithdraw,
this.onTransfer,
this.onProfit,
this.onBills,
});
final VoidCallback? onDeposit;
final VoidCallback? onWithdraw;
final VoidCallback? onTransfer;
final VoidCallback? onProfit;
final VoidCallback? onBills;
@override
@@ -55,12 +53,6 @@ class QuickActionsRow extends StatelessWidget {
colorScheme: colorScheme,
onTap: onTransfer,
),
_ActionItem(
icon: LucideIcons.chartPie,
label: '盈亏',
colorScheme: colorScheme,
onTap: onProfit,
),
_ActionItem(
icon: LucideIcons.fileText,
label: '账单',

View File

@@ -335,7 +335,7 @@ class _KycPageState extends State<KycPage> {
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
const Color(0x00000000),
Colors.transparent,
const Color(0x8A000000),
],
),

View File

@@ -72,7 +72,7 @@ class CoinSelector extends StatelessWidget {
void _showCoinPicker(BuildContext context) {
showModalBottomSheet(
context: context,
backgroundColor: const Color(0x00000000),
backgroundColor: Colors.transparent,
isScrollControlled: true,
builder: (ctx) => Container(
height: MediaQuery.of(ctx).size.height * 0.65,
@@ -143,7 +143,7 @@ class CoinSelector extends StatelessWidget {
padding: EdgeInsets.symmetric(
horizontal: AppSpacing.lg, vertical: AppSpacing.md),
color:
isSelected ? context.colors.primary.withValues(alpha: 0.1) : const Color(0x00000000),
isSelected ? context.colors.primary.withValues(alpha: 0.1) : Colors.transparent,
child: Row(
children: [
CoinAvatar(icon: coin.displayIcon),

View File

@@ -32,7 +32,7 @@ class ConfirmDialog extends StatelessWidget {
: context.appColors.down;
return Dialog(
backgroundColor: const Color(0x00000000),
backgroundColor: Colors.transparent,
child: GlassPanel(
borderRadius: BorderRadius.circular(AppRadius.lg),
padding: EdgeInsets.all(AppSpacing.lg),