2026-03-22 00:21:21 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
2026-03-22 04:50:19 +08:00
|
|
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
2026-03-22 00:21:21 +08:00
|
|
|
|
import 'package:provider/provider.dart';
|
2026-03-24 02:16:19 +08:00
|
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
2026-04-05 22:24:04 +08:00
|
|
|
|
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
2026-03-23 15:37:59 +08:00
|
|
|
|
import '../../../core/theme/app_color_scheme.dart';
|
|
|
|
|
|
import '../../../core/theme/app_spacing.dart';
|
2026-03-22 00:21:21 +08:00
|
|
|
|
import '../../../providers/auth_provider.dart';
|
2026-03-30 00:30:42 +08:00
|
|
|
|
import 'kyc_page.dart';
|
2026-03-23 14:12:00 +08:00
|
|
|
|
import '../../../providers/theme_provider.dart';
|
2026-03-23 00:08:19 +08:00
|
|
|
|
import '../auth/login_page.dart';
|
2026-04-04 21:19:29 +08:00
|
|
|
|
import 'welfare_center_page.dart';
|
2026-03-22 00:21:21 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
/// 我的页面 - 匹配 .pen 设计稿
|
2026-03-22 00:21:21 +08:00
|
|
|
|
class MinePage extends StatefulWidget {
|
|
|
|
|
|
const MinePage({super.key});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<MinePage> createState() => _MinePageState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
class _MinePageState extends State<MinePage>
|
|
|
|
|
|
with AutomaticKeepAliveClientMixin {
|
2026-03-22 00:21:21 +08:00
|
|
|
|
@override
|
|
|
|
|
|
bool get wantKeepAlive => true;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
super.build(context);
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-03-22 04:50:19 +08:00
|
|
|
|
|
2026-03-22 00:21:21 +08:00
|
|
|
|
return Scaffold(
|
2026-03-24 02:50:25 +08:00
|
|
|
|
backgroundColor: colorScheme.background,
|
2026-03-22 00:21:21 +08:00
|
|
|
|
body: Consumer<AuthProvider>(
|
|
|
|
|
|
builder: (context, auth, _) {
|
|
|
|
|
|
return SingleChildScrollView(
|
2026-04-05 22:24:04 +08:00
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
|
|
AppSpacing.md,
|
|
|
|
|
|
AppSpacing.md,
|
|
|
|
|
|
AppSpacing.md,
|
|
|
|
|
|
AppSpacing.xl + AppSpacing.md,
|
|
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
2026-04-05 22:24:04 +08:00
|
|
|
|
_ProfileCard(user: auth.user),
|
|
|
|
|
|
SizedBox(height: AppSpacing.sm),
|
|
|
|
|
|
_MenuGroup1(
|
2026-03-30 00:30:42 +08:00
|
|
|
|
kycStatus: auth.user?.kycStatus ?? 0,
|
2026-04-05 22:24:04 +08:00
|
|
|
|
onShowComingSoon: _showComingSoon,
|
2026-03-30 00:30:42 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
SizedBox(height: AppSpacing.sm),
|
|
|
|
|
|
_MenuGroup2(onShowAbout: _showAboutDialog),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
SizedBox(height: AppSpacing.lg),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
_LogoutButton(onLogout: () => _handleLogout(auth)),
|
|
|
|
|
|
SizedBox(height: AppSpacing.md),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
Text(
|
2026-04-05 22:24:04 +08:00
|
|
|
|
'System Build v1.0.0',
|
|
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
|
color: colorScheme.onSurfaceVariant.withOpacity(0.5),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-23 00:08:26 +08:00
|
|
|
|
void _showComingSoon(String feature) {
|
|
|
|
|
|
showShadDialog(
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
builder: (context) => ShadDialog.alert(
|
2026-03-23 15:37:59 +08:00
|
|
|
|
title: Row(
|
2026-03-23 00:08:26 +08:00
|
|
|
|
children: [
|
2026-03-24 02:16:19 +08:00
|
|
|
|
Icon(Icons.construction, color: AppColorScheme.warning, size: 20),
|
2026-03-23 15:37:59 +08:00
|
|
|
|
SizedBox(width: AppSpacing.sm),
|
|
|
|
|
|
const Text('功能开发中'),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
description: Text('$feature功能正在开发中,敬请期待~'),
|
|
|
|
|
|
actions: [
|
|
|
|
|
|
ShadButton(
|
|
|
|
|
|
child: const Text('知道了'),
|
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _showAboutDialog() {
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-03-23 00:08:26 +08:00
|
|
|
|
showShadDialog(
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
builder: (context) => ShadDialog(
|
|
|
|
|
|
title: Row(
|
|
|
|
|
|
children: [
|
2026-04-05 22:24:04 +08:00
|
|
|
|
_AvatarCircle(radius: 20, fontSize: 16),
|
2026-03-23 15:37:59 +08:00
|
|
|
|
SizedBox(width: AppSpacing.sm + AppSpacing.xs),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
const Text('模拟所'),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
children: [
|
2026-03-24 02:16:19 +08:00
|
|
|
|
Text(
|
|
|
|
|
|
'虚拟货币模拟交易平台',
|
2026-03-24 02:50:25 +08:00
|
|
|
|
style: TextStyle(color: colorScheme.onSurfaceVariant),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-03-23 15:37:59 +08:00
|
|
|
|
SizedBox(height: AppSpacing.md),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
_InfoRow(icon: Icons.code, text: '版本: 1.0.0'),
|
2026-03-23 15:37:59 +08:00
|
|
|
|
SizedBox(height: AppSpacing.sm),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
_InfoRow(
|
|
|
|
|
|
icon: Icons.favorite,
|
|
|
|
|
|
text: 'Built with Flutter & Material Design 3'),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
actions: [
|
|
|
|
|
|
ShadButton(
|
|
|
|
|
|
child: const Text('确定'),
|
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _handleLogout(AuthProvider auth) {
|
|
|
|
|
|
showShadDialog(
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
builder: (ctx) => ShadDialog.alert(
|
|
|
|
|
|
title: const Text('确认退出'),
|
|
|
|
|
|
description: const Text('确定要退出登录吗?'),
|
|
|
|
|
|
actions: [
|
|
|
|
|
|
ShadButton.outline(
|
|
|
|
|
|
child: const Text('取消'),
|
|
|
|
|
|
onPressed: () => Navigator.of(ctx).pop(),
|
|
|
|
|
|
),
|
|
|
|
|
|
ShadButton.destructive(
|
|
|
|
|
|
child: const Text('退出'),
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
Navigator.of(ctx).pop();
|
|
|
|
|
|
await auth.logout();
|
|
|
|
|
|
if (ctx.mounted) {
|
|
|
|
|
|
Navigator.of(ctx).pushAndRemoveUntil(
|
|
|
|
|
|
MaterialPageRoute(builder: (_) => const LoginPage()),
|
|
|
|
|
|
(route) => false,
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Profile Card
|
|
|
|
|
|
// ============================================================
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
/// 用户资料卡片 - 头像 + 用户名 + 徽章 + chevron
|
|
|
|
|
|
class _ProfileCard extends StatelessWidget {
|
|
|
|
|
|
final dynamic user;
|
|
|
|
|
|
const _ProfileCard({required this.user});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
return Container(
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: isDark
|
|
|
|
|
|
? colorScheme.surfaceContainer
|
|
|
|
|
|
: colorScheme.surfaceContainerHigh,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
|
|
|
|
border: Border.all(
|
|
|
|
|
|
color: colorScheme.outlineVariant.withOpacity(0.15),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// Avatar
|
|
|
|
|
|
_AvatarCircle(
|
|
|
|
|
|
radius: 24,
|
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
|
text: user?.avatarText,
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const SizedBox(width: 12),
|
|
|
|
|
|
// Name + badge column
|
2026-03-22 00:21:21 +08:00
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Text(
|
|
|
|
|
|
user?.username ?? '未登录',
|
2026-04-05 22:24:04 +08:00
|
|
|
|
style: GoogleFonts.inter(
|
2026-04-01 12:49:17 +08:00
|
|
|
|
fontSize: 16,
|
2026-04-05 22:24:04 +08:00
|
|
|
|
fontWeight: FontWeight.w600,
|
2026-03-24 02:50:25 +08:00
|
|
|
|
color: colorScheme.onSurface,
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
'普通用户',
|
|
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
|
color: colorScheme.onSurfaceVariant,
|
2026-03-22 00:21:21 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// Chevron
|
2026-03-24 02:16:19 +08:00
|
|
|
|
Icon(
|
|
|
|
|
|
LucideIcons.chevronRight,
|
2026-04-05 22:24:04 +08:00
|
|
|
|
size: 16,
|
2026-03-24 02:50:25 +08:00
|
|
|
|
color: colorScheme.onSurfaceVariant,
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2026-03-23 00:08:26 +08:00
|
|
|
|
}
|
2026-03-22 00:21:21 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
/// 圆形头像组件
|
|
|
|
|
|
class _AvatarCircle extends StatelessWidget {
|
2026-03-23 00:08:26 +08:00
|
|
|
|
final double radius;
|
|
|
|
|
|
final double fontSize;
|
|
|
|
|
|
final String? text;
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const _AvatarCircle({
|
|
|
|
|
|
required this.radius,
|
|
|
|
|
|
required this.fontSize,
|
|
|
|
|
|
this.text,
|
|
|
|
|
|
});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-04-05 22:24:04 +08:00
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
2026-03-24 02:50:25 +08:00
|
|
|
|
|
2026-03-23 00:08:26 +08:00
|
|
|
|
return CircleAvatar(
|
|
|
|
|
|
radius: radius,
|
2026-04-05 22:24:04 +08:00
|
|
|
|
backgroundColor: colorScheme.primary.withOpacity(0.15),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
child: Text(
|
|
|
|
|
|
text ?? '₿',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: fontSize,
|
2026-03-24 02:50:25 +08:00
|
|
|
|
color: colorScheme.primary,
|
2026-04-05 22:24:04 +08:00
|
|
|
|
fontWeight: FontWeight.w700,
|
2026-03-23 00:08:26 +08:00
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Menu Group 1 - 福利中心 / 实名认证 / 安全设置 / 消息通知
|
|
|
|
|
|
// ============================================================
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
class _MenuGroup1 extends StatelessWidget {
|
|
|
|
|
|
final int kycStatus;
|
|
|
|
|
|
final void Function(String) onShowComingSoon;
|
|
|
|
|
|
|
|
|
|
|
|
const _MenuGroup1({
|
|
|
|
|
|
required this.kycStatus,
|
|
|
|
|
|
required this.onShowComingSoon,
|
|
|
|
|
|
});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-04-05 22:24:04 +08:00
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
2026-03-24 02:50:25 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
return Container(
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: isDark
|
|
|
|
|
|
? colorScheme.surfaceContainer
|
|
|
|
|
|
: colorScheme.surfaceContainerHigh,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
|
|
|
|
border: Border.all(
|
|
|
|
|
|
color: colorScheme.outlineVariant.withOpacity(0.15),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
// 福利中心
|
|
|
|
|
|
_MenuRow(
|
|
|
|
|
|
icon: LucideIcons.gift,
|
|
|
|
|
|
iconColor: AppColorScheme.darkSecondary, // gold
|
|
|
|
|
|
title: '福利中心',
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
context,
|
|
|
|
|
|
MaterialPageRoute(builder: (_) => const WelfareCenterPage()),
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
_MenuDivider(),
|
|
|
|
|
|
// 实名认证
|
|
|
|
|
|
_MenuRow(
|
|
|
|
|
|
icon: LucideIcons.shieldCheck,
|
|
|
|
|
|
iconColor: AppColorScheme.getUpColor(isDark),
|
|
|
|
|
|
title: '实名认证',
|
|
|
|
|
|
trailing: _KycBadge(kycStatus: kycStatus),
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
if (kycStatus == 2) {
|
|
|
|
|
|
_showKycStatusDialog(context);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
context,
|
|
|
|
|
|
MaterialPageRoute(builder: (_) => const KycPage()),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
_MenuDivider(),
|
|
|
|
|
|
// 安全设置
|
|
|
|
|
|
_MenuRow(
|
|
|
|
|
|
icon: LucideIcons.lock,
|
|
|
|
|
|
iconColor: colorScheme.onSurfaceVariant,
|
|
|
|
|
|
title: '安全设置',
|
|
|
|
|
|
onTap: () => onShowComingSoon('安全设置'),
|
|
|
|
|
|
),
|
|
|
|
|
|
_MenuDivider(),
|
|
|
|
|
|
// 消息通知
|
|
|
|
|
|
_MenuRow(
|
|
|
|
|
|
icon: LucideIcons.bell,
|
|
|
|
|
|
iconColor: colorScheme.onSurfaceVariant,
|
|
|
|
|
|
title: '消息通知',
|
|
|
|
|
|
trailing: _RedDotIndicator(),
|
|
|
|
|
|
onTap: () => onShowComingSoon('消息通知'),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Menu Group 2 - 深色模式 / 系统设置 / 关于我们
|
|
|
|
|
|
// ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
class _MenuGroup2 extends StatelessWidget {
|
2026-03-23 00:08:26 +08:00
|
|
|
|
final VoidCallback onShowAbout;
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const _MenuGroup2({required this.onShowAbout});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-04-05 22:24:04 +08:00
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
2026-03-22 04:50:19 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
return Container(
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: isDark
|
|
|
|
|
|
? colorScheme.surfaceContainer
|
|
|
|
|
|
: colorScheme.surfaceContainerHigh,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
|
|
|
|
border: Border.all(
|
|
|
|
|
|
color: colorScheme.outlineVariant.withOpacity(0.15),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-03-22 00:21:21 +08:00
|
|
|
|
child: Column(
|
2026-03-23 00:08:26 +08:00
|
|
|
|
children: [
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// 深色模式
|
|
|
|
|
|
_DarkModeRow(),
|
|
|
|
|
|
_MenuDivider(),
|
|
|
|
|
|
// 系统设置
|
|
|
|
|
|
_MenuRow(
|
|
|
|
|
|
icon: LucideIcons.settings,
|
|
|
|
|
|
iconColor: colorScheme.onSurfaceVariant,
|
|
|
|
|
|
title: '系统设置',
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
// TODO: 系统设置
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
_MenuDivider(),
|
|
|
|
|
|
// 关于我们
|
|
|
|
|
|
_MenuRow(
|
|
|
|
|
|
icon: LucideIcons.info,
|
|
|
|
|
|
iconColor: colorScheme.onSurfaceVariant,
|
|
|
|
|
|
title: '关于我们',
|
|
|
|
|
|
onTap: onShowAbout,
|
|
|
|
|
|
),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
],
|
2026-03-22 00:21:21 +08:00
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2026-03-23 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Shared menu row components
|
|
|
|
|
|
// ============================================================
|
2026-03-30 00:30:42 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
/// 单行菜单项:icon-in-box + title + trailing (chevron / badge / toggle)
|
|
|
|
|
|
class _MenuRow extends StatelessWidget {
|
|
|
|
|
|
final IconData icon;
|
|
|
|
|
|
final Color iconColor;
|
|
|
|
|
|
final String title;
|
|
|
|
|
|
final Widget? trailing;
|
|
|
|
|
|
final VoidCallback? onTap;
|
2026-03-23 14:12:00 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const _MenuRow({
|
|
|
|
|
|
required this.icon,
|
|
|
|
|
|
required this.iconColor,
|
|
|
|
|
|
required this.title,
|
|
|
|
|
|
this.trailing,
|
|
|
|
|
|
this.onTap,
|
|
|
|
|
|
});
|
2026-03-23 14:12:00 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return InkWell(
|
2026-04-05 22:24:04 +08:00
|
|
|
|
onTap: onTap,
|
2026-03-23 14:12:00 +08:00
|
|
|
|
child: Padding(
|
2026-04-05 22:24:04 +08:00
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
2026-03-23 14:12:00 +08:00
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// Icon in 36x36 rounded container
|
|
|
|
|
|
Container(
|
|
|
|
|
|
width: 36,
|
|
|
|
|
|
height: 36,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: Theme.of(context).brightness == Brightness.dark
|
|
|
|
|
|
? Theme.of(context).colorScheme.surfaceContainerHigh
|
|
|
|
|
|
: Theme.of(context).colorScheme.surfaceContainerHighest,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
child: Icon(icon, size: 18, color: iconColor),
|
|
|
|
|
|
),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
|
// Title
|
2026-03-23 14:12:00 +08:00
|
|
|
|
Expanded(
|
2026-04-05 22:24:04 +08:00
|
|
|
|
child: Text(
|
|
|
|
|
|
title,
|
|
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
|
|
|
|
),
|
2026-03-23 14:12:00 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// Trailing
|
|
|
|
|
|
if (trailing != null)
|
|
|
|
|
|
trailing!
|
|
|
|
|
|
else
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
LucideIcons.chevronRight,
|
|
|
|
|
|
size: 16,
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
|
|
|
|
),
|
2026-03-23 14:12:00 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
/// Menu group divider
|
|
|
|
|
|
class _MenuDivider extends StatelessWidget {
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
height: 1,
|
|
|
|
|
|
color: Theme.of(context).colorScheme.outlineVariant.withOpacity(0.15),
|
|
|
|
|
|
margin: const EdgeInsets.only(left: 62),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Special trailing widgets
|
|
|
|
|
|
// ============================================================
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
/// KYC status badge (e.g. "已认证" green badge + chevron)
|
|
|
|
|
|
class _KycBadge extends StatelessWidget {
|
|
|
|
|
|
final int kycStatus;
|
|
|
|
|
|
const _KycBadge({required this.kycStatus});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-04-05 22:24:04 +08:00
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
|
|
final green = AppColorScheme.getUpColor(isDark);
|
2026-03-24 02:50:25 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
if (kycStatus == 2) {
|
|
|
|
|
|
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: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|
color: green,
|
2026-03-22 04:50:19 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
LucideIcons.chevronRight,
|
|
|
|
|
|
size: 16,
|
|
|
|
|
|
color: Theme.of(context).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),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
child: Text(
|
|
|
|
|
|
'审核中',
|
|
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|
color: AppColorScheme.warning,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
LucideIcons.chevronRight,
|
|
|
|
|
|
size: 16,
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Icon(
|
|
|
|
|
|
LucideIcons.chevronRight,
|
|
|
|
|
|
size: 16,
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Red dot indicator for notifications + chevron
|
|
|
|
|
|
class _RedDotIndicator extends StatelessWidget {
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Row(
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Container(
|
|
|
|
|
|
width: 8,
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: AppColorScheme.down,
|
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
|
),
|
2026-03-22 04:50:19 +08:00
|
|
|
|
),
|
2026-04-05 22:24:04 +08:00
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
LucideIcons.chevronRight,
|
|
|
|
|
|
size: 16,
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Dark mode toggle row
|
|
|
|
|
|
class _DarkModeRow extends StatelessWidget {
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
|
|
final themeProvider = context.watch<ThemeProvider>();
|
|
|
|
|
|
|
|
|
|
|
|
return Padding(
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
// Icon in 36x36 rounded container
|
|
|
|
|
|
Container(
|
|
|
|
|
|
width: 36,
|
|
|
|
|
|
height: 36,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: isDark
|
|
|
|
|
|
? colorScheme.surfaceContainerHigh
|
|
|
|
|
|
: colorScheme.surfaceContainerHighest,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
LucideIcons.moon,
|
|
|
|
|
|
size: 18,
|
|
|
|
|
|
color: colorScheme.onSurfaceVariant,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
const SizedBox(width: 10),
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
'深色模式',
|
|
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
|
color: colorScheme.onSurface,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
// Toggle switch - matching .pen design (44x24 rounded pill)
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () => themeProvider.toggleTheme(),
|
|
|
|
|
|
child: AnimatedContainer(
|
|
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
|
|
width: 44,
|
|
|
|
|
|
height: 24,
|
|
|
|
|
|
padding: const EdgeInsets.all(2),
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: isDark
|
|
|
|
|
|
? colorScheme.surfaceContainerHigh
|
|
|
|
|
|
: colorScheme.surfaceContainerHighest,
|
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: AnimatedAlign(
|
|
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
|
|
alignment:
|
|
|
|
|
|
themeProvider.isDarkMode
|
|
|
|
|
|
? Alignment.centerRight
|
|
|
|
|
|
: Alignment.centerLeft,
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
width: 20,
|
|
|
|
|
|
height: 20,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: colorScheme.onSurface,
|
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
2026-03-22 00:21:21 +08:00
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2026-03-23 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Logout button
|
|
|
|
|
|
// ============================================================
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
class _LogoutButton extends StatelessWidget {
|
|
|
|
|
|
final VoidCallback onLogout;
|
|
|
|
|
|
const _LogoutButton({required this.onLogout});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-03-24 02:50:25 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
return GestureDetector(
|
|
|
|
|
|
onTap: onLogout,
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
height: 48,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: AppColorScheme.down.withOpacity(0.05),
|
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
|
|
|
|
border: Border.all(
|
|
|
|
|
|
color: AppColorScheme.down.withOpacity(0.15),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
'退出登录',
|
|
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
|
color: AppColorScheme.down,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2026-03-24 02:16:19 +08:00
|
|
|
|
),
|
2026-03-23 00:08:26 +08:00
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
// ============================================================
|
|
|
|
|
|
// Info row (used in about dialog)
|
|
|
|
|
|
// ============================================================
|
2026-03-22 00:21:21 +08:00
|
|
|
|
|
2026-04-05 22:24:04 +08:00
|
|
|
|
class _InfoRow extends StatelessWidget {
|
|
|
|
|
|
final IconData icon;
|
|
|
|
|
|
final String text;
|
|
|
|
|
|
|
|
|
|
|
|
const _InfoRow({required this.icon, required this.text});
|
2026-03-23 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-04-05 22:24:04 +08:00
|
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
|
|
|
|
|
|
|
|
|
|
return Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Icon(icon, size: 14, color: colorScheme.onSurfaceVariant),
|
|
|
|
|
|
SizedBox(width: AppSpacing.sm),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
text,
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
|
color: colorScheme.onSurfaceVariant,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
2026-03-22 04:50:19 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-05 22:24:04 +08:00
|
|
|
|
|
|
|
|
|
|
// ============================================================
|
|
|
|
|
|
// KYC status dialog
|
|
|
|
|
|
// ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
void _showKycStatusDialog(BuildContext context) {
|
|
|
|
|
|
showShadDialog(
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
builder: (ctx) => ShadDialog.alert(
|
|
|
|
|
|
title: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Icon(Icons.check_circle, color: AppColorScheme.up, size: 20),
|
|
|
|
|
|
SizedBox(width: AppSpacing.sm),
|
|
|
|
|
|
const Text('实名认证'),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
description: const Text('您的实名认证已通过'),
|
|
|
|
|
|
actions: [
|
|
|
|
|
|
ShadButton(
|
|
|
|
|
|
child: const Text('确定'),
|
|
|
|
|
|
onPressed: () => Navigator.of(ctx).pop(),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|