From 7bbc75a4573fdd4e98b4762f06ed84a9fb1b613a Mon Sep 17 00:00:00 2001 From: sion <450702724@qq.com> Date: Mon, 6 Apr 2026 00:24:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CLAUDE.md | 2 +- .../lib/ui/pages/asset/asset_page.dart | 68 ++-------- .../ui/pages/mine/components/menu_row.dart | 7 +- .../components/menu_trailing_widgets.dart | 117 +++++++++--------- 4 files changed, 75 insertions(+), 119 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index f18f055..db7b5e2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -65,7 +65,7 @@ deploy/deploy_server.sh backend # 仅部署后端 ### Flutter 应用 (`flutter_monisuo/lib/`) - **状态管理**:Provider(ChangeNotifier)— `providers/` 消费 `data/services/`,底层调用 `core/network/DioClient`。 - **主题样式**:前端禁止硬编码,新设计统一维护到theme目录的定义中,并尽可能复用设计主题。 -- **UI**:shadcn_ui + 自定义主题系统(`core/theme/`)。颜色集中管理在 `AppColorScheme`。 +- **UI**:shadcn_ui + 自定义主题系统(`core/theme/`)。颜色集中管理在 `AppColorScheme`,组件过大,需要组件化,而不是堆积。 - **数据流**:`data/services/`(API 调用)→ `providers/`(状态)→ `ui/pages/`(视图)。 - 页面:auth、home、market、trade、asset、mine、orders、onboarding。 diff --git a/flutter_monisuo/lib/ui/pages/asset/asset_page.dart b/flutter_monisuo/lib/ui/pages/asset/asset_page.dart index 3cabf54..61f9936 100644 --- a/flutter_monisuo/lib/ui/pages/asset/asset_page.dart +++ b/flutter_monisuo/lib/ui/pages/asset/asset_page.dart @@ -116,55 +116,22 @@ class _AssetPageState extends State with AutomaticKeepAliveClientMixi HoldingsSection(holdings: _activeTab == 1 ? provider.holdings : []), ], ), - ], - ), - SizedBox(height: AppSpacing.sm), - Text( - displayBalance, - style: GoogleFonts.spaceGrotesk( - fontSize: 20, - fontWeight: FontWeight.bold, - color: colorScheme.onSurface, ), - ), - SizedBox(height: AppSpacing.lg), - Row( - children: [ - Expanded( - child: NeonButton( - text: '充值', - type: NeonButtonType.tertiary, - onPressed: () => _showDepositDialog(context), - height: 44, - showGlow: false, - ), - ), - SizedBox(width: AppSpacing.sm), - Expanded( - child: NeonButton( - text: '提现', - type: NeonButtonType.secondary, - onPressed: () => _showWithdrawDialog(context, fund?.balance), - height: 44, - showGlow: false, - ), - ), - SizedBox(width: AppSpacing.sm), - Expanded( - child: NeonButton( - text: '划转', - type: NeonButtonType.outline, - onPressed: () => _navigateToTransfer(context), - height: 44, - showGlow: false, - ), - ), - ], - ), - ], + ); + }, ), ); } + + void _navigateToTransfer(BuildContext context) async { + final result = await Navigator.push( + context, + MaterialPageRoute(builder: (_) => const TransferPage()), + ); + if (result == true && context.mounted) { + context.read().refreshAll(force: true); + } + } } /// 交易账户卡片 - Glass Panel 风格 @@ -1021,14 +988,3 @@ void _showWithdrawDialog(BuildContext context, String? balance) { ), ); } - - void _navigateToTransfer(BuildContext context) async { - final result = await Navigator.push( - context, - MaterialPageRoute(builder: (_) => const TransferPage()), - ); - if (result == true && context.mounted) { - context.read().refreshAll(force: true); - } - } -} diff --git a/flutter_monisuo/lib/ui/pages/mine/components/menu_row.dart b/flutter_monisuo/lib/ui/pages/mine/components/menu_row.dart index f720454..adf93b3 100644 --- a/flutter_monisuo/lib/ui/pages/mine/components/menu_row.dart +++ b/flutter_monisuo/lib/ui/pages/mine/components/menu_row.dart @@ -4,10 +4,10 @@ import '../../../../core/theme/app_spacing.dart'; import '../../../../core/theme/app_theme.dart'; /// 单行菜单项:图标 + 标题 + 尾部组件 (chevron) - right) /// /// 图标颜色 (通常是使用主题色) class MenuRow extends StatelessWidget { + final IconData icon; final Color iconColor; final String title; final Widget? trailing; @@ -15,10 +15,10 @@ class MenuRow extends StatelessWidget { const MenuRow({ super.key, + required this.icon, required this.iconColor, required this.title, this.trailing, - super.key, required this.iconColor = required this.title, this.onTap, }); @@ -26,7 +26,7 @@ class MenuRow extends StatelessWidget { Widget build(BuildContext context) { return InkWell( onTap: onTap, - child: Padding( + child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14), child: Row( children: [ @@ -59,7 +59,6 @@ class MenuRow extends StatelessWidget { size: 16, color: Theme.of(context).colorScheme.onSurfaceVariant, ), - ], ], ), ), diff --git a/flutter_monisuo/lib/ui/pages/mine/components/menu_trailing_widgets.dart b/flutter_monisuo/lib/ui/pages/mine/components/menu_trailing_widgets.dart index fdc5a86..e85a4be 100644 --- a/flutter_monisuo/lib/ui/pages/mine/components/menu_trailing_widgets.dart +++ b/flutter_monisuo/lib/ui/pages/mine/components/menu_trailing_widgets.dart @@ -1,17 +1,17 @@ import 'package:flutter/material.dart'; import 'package:lucide_icons_flutter/lucide_icons.dart'; +import 'package:provider/provider.dart'; import '../../../../core/theme/app_color_scheme.dart'; import '../../../../core/theme/app_spacing.dart'; import '../../../../core/theme/app_theme.dart'; -import '../../../../core/providers/theme_provider.dart'; +import '../../../../providers/theme_provider.dart'; /// KYC 状态徽章 (e.g. "已认证" green badge + chevron) - /// +/// /// 根据 [kycStatus] 显示不同状态: /// - 2: 已认证(绿色) /// - 1: 审核中(橙色) - /// - 其他: 仅显示 chevron - */ +/// - 其他: 仅显示 chevron class KycBadge extends StatelessWidget { final int kycStatus; const KycBadge({super.key, required this.kycStatus}); @@ -20,64 +20,66 @@ class KycBadge extends StatelessWidget { Widget build(BuildContext context) { final isDark = Theme.of(context).brightness == Brightness.dark; final green = AppColorScheme.getUpColor(isDark); + final colorScheme = Theme.of(context).colorScheme; - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), - decoration: BoxDecoration( - color: green.withOpacity(0.1), - borderRadius: BorderRadius.circular(AppRadius.sm), - ), - child: Text( - '已认证', - style: AppTextStyles.labelMedium(context).copyWith( - color: green, + if (kycStatus == 2) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), + decoration: BoxDecoration( + color: green.withValues(alpha: 0.1), + borderRadius: BorderRadius.circular(AppRadius.sm), + ), + child: Text( + '已认证', + style: AppTextStyles.labelMedium(context).copyWith( + color: green, + ), ), ), - ), - const SizedBox(width: 8), - Icon( - LucideIcons.chevronRight, - size: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ], - ); - } + const SizedBox(width: 8), + Icon( + LucideIcons.chevronRight, + size: 16, + color: colorScheme.onSurfaceVariant, + ), + ], + ); + } if (kycStatus == 1) { return Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), - decoration: BoxDecoration( - color: AppColorScheme.warning.withOpacity(0.1), - borderRadius: BorderRadius.circular(AppRadius.sm), - ), - child: Text( - '审核中', - style: AppTextStyles.labelMedium(context).copyWith( - color: AppColorScheme.warning, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), + decoration: BoxDecoration( + color: AppColorScheme.warning.withValues(alpha: 0.1), + borderRadius: BorderRadius.circular(AppRadius.sm), + ), + child: Text( + '审核中', + style: AppTextStyles.labelMedium(context).copyWith( + color: AppColorScheme.warning, + ), ), ), - ), - const SizedBox(width: 8), - Icon( - LucideIcons.chevronRight, - size: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ], - ); - } + const SizedBox(width: 8), + Icon( + LucideIcons.chevronRight, + size: 16, + color: colorScheme.onSurfaceVariant, + ), + ], + ); + } return Icon( LucideIcons.chevronRight, size: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: colorScheme.onSurfaceVariant, ); } } @@ -95,8 +97,9 @@ class RedDotIndicator extends StatelessWidget { width: 8, height: 8, decoration: BoxDecoration( - color: AppColorScheme.down, - shape: BoxShape.circle, + color: AppColorScheme.down, + shape: BoxShape.circle, + ), ), const SizedBox(width: 8), Icon( @@ -149,9 +152,6 @@ class DarkModeRow extends StatelessWidget { ), ), // Toggle switch - matching .pen design (44x24 rounded pill) - // thumb - custom radius -12) GestureDetector( onTap: () => themeProvider.toggleTheme(), child: AnimatedContainer( @@ -164,7 +164,7 @@ class DarkModeRow extends StatelessWidget { ? colorScheme.surfaceContainerHigh : colorScheme.surfaceContainerHighest, borderRadius: BorderRadius.circular(12), - ), + ), child: AnimatedAlign( duration: const Duration(milliseconds: 200), alignment: @@ -179,8 +179,9 @@ class DarkModeRow extends StatelessWidget { ), ), ), - ], - ), + ), + ), + ], ), ); }