This commit is contained in:
2026-04-06 00:24:54 +08:00
parent 40ed445ae5
commit 7bbc75a457
4 changed files with 75 additions and 119 deletions

View File

@@ -65,7 +65,7 @@ deploy/deploy_server.sh backend # 仅部署后端
### Flutter 应用 (`flutter_monisuo/lib/`) ### Flutter 应用 (`flutter_monisuo/lib/`)
- **状态管理**ProviderChangeNotifier`providers/` 消费 `data/services/`,底层调用 `core/network/DioClient` - **状态管理**ProviderChangeNotifier`providers/` 消费 `data/services/`,底层调用 `core/network/DioClient`
- **主题样式**前端禁止硬编码新设计统一维护到theme目录的定义中,并尽可能复用设计主题。 - **主题样式**前端禁止硬编码新设计统一维护到theme目录的定义中,并尽可能复用设计主题。
- **UI**shadcn_ui + 自定义主题系统(`core/theme/`)。颜色集中管理在 `AppColorScheme` - **UI**shadcn_ui + 自定义主题系统(`core/theme/`)。颜色集中管理在 `AppColorScheme`,组件过大,需要组件化,而不是堆积
- **数据流**`data/services/`API 调用)→ `providers/`(状态)→ `ui/pages/`(视图)。 - **数据流**`data/services/`API 调用)→ `providers/`(状态)→ `ui/pages/`(视图)。
- 页面auth、home、market、trade、asset、mine、orders、onboarding。 - 页面auth、home、market、trade、asset、mine、orders、onboarding。

View File

@@ -116,54 +116,21 @@ class _AssetPageState extends State<AssetPage> with AutomaticKeepAliveClientMixi
HoldingsSection(holdings: _activeTab == 1 ? provider.holdings : []), 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<bool>(
context,
MaterialPageRoute(builder: (_) => const TransferPage()),
);
if (result == true && context.mounted) {
context.read<AssetProvider>().refreshAll(force: true);
}
} }
} }
@@ -1021,14 +988,3 @@ void _showWithdrawDialog(BuildContext context, String? balance) {
), ),
); );
} }
void _navigateToTransfer(BuildContext context) async {
final result = await Navigator.push<bool>(
context,
MaterialPageRoute(builder: (_) => const TransferPage()),
);
if (result == true && context.mounted) {
context.read<AssetProvider>().refreshAll(force: true);
}
}
}

View File

@@ -4,10 +4,10 @@ import '../../../../core/theme/app_spacing.dart';
import '../../../../core/theme/app_theme.dart'; import '../../../../core/theme/app_theme.dart';
/// 单行菜单项:图标 + 标题 + 尾部组件 (chevron) /// 单行菜单项:图标 + 标题 + 尾部组件 (chevron)
right)
/// ///
/// 图标颜色 (通常是使用主题色) /// 图标颜色 (通常是使用主题色)
class MenuRow extends StatelessWidget { class MenuRow extends StatelessWidget {
final IconData icon;
final Color iconColor; final Color iconColor;
final String title; final String title;
final Widget? trailing; final Widget? trailing;
@@ -15,10 +15,10 @@ class MenuRow extends StatelessWidget {
const MenuRow({ const MenuRow({
super.key, super.key,
required this.icon,
required this.iconColor, required this.iconColor,
required this.title, required this.title,
this.trailing, this.trailing,
super.key, required this.iconColor = required this.title,
this.onTap, this.onTap,
}); });
@@ -60,7 +60,6 @@ class MenuRow extends StatelessWidget {
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.onSurfaceVariant,
), ),
], ],
],
), ),
), ),
); );

View File

@@ -1,9 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.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_color_scheme.dart';
import '../../../../core/theme/app_spacing.dart'; import '../../../../core/theme/app_spacing.dart';
import '../../../../core/theme/app_theme.dart'; import '../../../../core/theme/app_theme.dart';
import '../../../../core/providers/theme_provider.dart'; import '../../../../providers/theme_provider.dart';
/// KYC 状态徽章 (e.g. "已认证" green badge + chevron) /// KYC 状态徽章 (e.g. "已认证" green badge + chevron)
/// ///
@@ -11,7 +12,6 @@ import '../../../../core/providers/theme_provider.dart';
/// - 2: 已认证(绿色) /// - 2: 已认证(绿色)
/// - 1: 审核中(橙色) /// - 1: 审核中(橙色)
/// - 其他: 仅显示 chevron /// - 其他: 仅显示 chevron
*/
class KycBadge extends StatelessWidget { class KycBadge extends StatelessWidget {
final int kycStatus; final int kycStatus;
const KycBadge({super.key, required this.kycStatus}); const KycBadge({super.key, required this.kycStatus});
@@ -20,14 +20,16 @@ class KycBadge extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDark = Theme.of(context).brightness == Brightness.dark; final isDark = Theme.of(context).brightness == Brightness.dark;
final green = AppColorScheme.getUpColor(isDark); final green = AppColorScheme.getUpColor(isDark);
final colorScheme = Theme.of(context).colorScheme;
if (kycStatus == 2) {
return Row( return Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
color: green.withOpacity(0.1), color: green.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(AppRadius.sm), borderRadius: BorderRadius.circular(AppRadius.sm),
), ),
child: Text( child: Text(
@@ -41,7 +43,7 @@ class KycBadge extends StatelessWidget {
Icon( Icon(
LucideIcons.chevronRight, LucideIcons.chevronRight,
size: 16, size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
], ],
); );
@@ -54,7 +56,7 @@ class KycBadge extends StatelessWidget {
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColorScheme.warning.withOpacity(0.1), color: AppColorScheme.warning.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(AppRadius.sm), borderRadius: BorderRadius.circular(AppRadius.sm),
), ),
child: Text( child: Text(
@@ -68,7 +70,7 @@ class KycBadge extends StatelessWidget {
Icon( Icon(
LucideIcons.chevronRight, LucideIcons.chevronRight,
size: 16, size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
], ],
); );
@@ -77,7 +79,7 @@ class KycBadge extends StatelessWidget {
return Icon( return Icon(
LucideIcons.chevronRight, LucideIcons.chevronRight,
size: 16, size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: colorScheme.onSurfaceVariant,
); );
} }
} }
@@ -98,6 +100,7 @@ class RedDotIndicator extends StatelessWidget {
color: AppColorScheme.down, color: AppColorScheme.down,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Icon( Icon(
LucideIcons.chevronRight, LucideIcons.chevronRight,
@@ -149,9 +152,6 @@ class DarkModeRow extends StatelessWidget {
), ),
), ),
// Toggle switch - matching .pen design (44x24 rounded pill) // Toggle switch - matching .pen design (44x24 rounded pill)
// thumb
custom radius
12)
GestureDetector( GestureDetector(
onTap: () => themeProvider.toggleTheme(), onTap: () => themeProvider.toggleTheme(),
child: AnimatedContainer( child: AnimatedContainer(
@@ -179,9 +179,10 @@ class DarkModeRow extends StatelessWidget {
), ),
), ),
), ),
],
), ),
), ),
],
),
); );
} }
} }