Removed outdated compatibility aliases and deprecated methods from AppColorScheme, and updated CLAUDE.md to reflect new theme system requirements with centralized color management and no hard-coded values in UI components.
161 lines
4.8 KiB
Dart
161 lines
4.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.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 '../../../providers/auth_provider.dart';
|
|
import '../auth/login_page.dart';
|
|
import 'components/about_dialog_helpers.dart';
|
|
import 'components/avatar_circle.dart';
|
|
import 'components/logout_button.dart';
|
|
import 'components/menu_group1.dart';
|
|
import 'components/menu_group2.dart';
|
|
import 'components/profile_card.dart';
|
|
|
|
/// 我的页面 - 匹配 .pen 设计稿
|
|
class MinePage extends StatefulWidget {
|
|
const MinePage({super.key});
|
|
|
|
@override
|
|
State<MinePage> createState() => _MinePageState();
|
|
}
|
|
|
|
class _MinePageState extends State<MinePage>
|
|
with AutomaticKeepAliveClientMixin {
|
|
@override
|
|
bool get wantKeepAlive => true;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
super.build(context);
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
|
|
return Scaffold(
|
|
backgroundColor: colorScheme.background,
|
|
body: Consumer<AuthProvider>(
|
|
builder: (context, auth, _) {
|
|
return SingleChildScrollView(
|
|
padding: EdgeInsets.fromLTRB(
|
|
AppSpacing.md,
|
|
AppSpacing.md,
|
|
AppSpacing.md,
|
|
AppSpacing.xl + AppSpacing.md,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
ProfileCard(user: auth.user),
|
|
SizedBox(height: AppSpacing.sm),
|
|
MenuGroup1(
|
|
kycStatus: auth.user?.kycStatus ?? 0,
|
|
onShowComingSoon: _showComingSoon,
|
|
),
|
|
SizedBox(height: AppSpacing.sm),
|
|
MenuGroup2(onShowAbout: _showAboutDialog),
|
|
SizedBox(height: AppSpacing.lg),
|
|
LogoutButton(onLogout: () => _handleLogout(auth)),
|
|
SizedBox(height: AppSpacing.md),
|
|
Text(
|
|
'System Build v1.0.0',
|
|
style: AppTextStyles.bodySmall(context).copyWith(
|
|
color: colorScheme.onSurfaceVariant.withOpacity(0.5),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showComingSoon(String feature) {
|
|
showShadDialog(
|
|
context: context,
|
|
builder: (context) => ShadDialog.alert(
|
|
title: Row(
|
|
children: [
|
|
Icon(Icons.construction, color: AppColorScheme.warning, size: 20),
|
|
SizedBox(width: AppSpacing.sm),
|
|
const Text('功能开发中'),
|
|
],
|
|
),
|
|
description: Text('$feature功能正在开发中,敬请期待~'),
|
|
actions: [
|
|
ShadButton(
|
|
child: const Text('知道了'),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showAboutDialog() {
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
showShadDialog(
|
|
context: context,
|
|
builder: (context) => ShadDialog(
|
|
title: Row(
|
|
children: [
|
|
AvatarCircle(radius: 20, fontSize: 16),
|
|
SizedBox(width: AppSpacing.sm + AppSpacing.xs),
|
|
const Text('模拟所'),
|
|
],
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'虚拟货币模拟交易平台',
|
|
style: TextStyle(color: colorScheme.onSurfaceVariant),
|
|
),
|
|
SizedBox(height: AppSpacing.md),
|
|
InfoRow(icon: Icons.code, text: '版本: 1.0.0'),
|
|
SizedBox(height: AppSpacing.sm),
|
|
InfoRow(
|
|
icon: Icons.favorite,
|
|
text: 'Built with Flutter & Material Design 3'),
|
|
],
|
|
),
|
|
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,
|
|
);
|
|
}
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|