refactor: 前端改 2 Tab(穿搭向导 + 我的入口)
- 主框架收敛为「穿搭」「我的」两个 tab:
- 穿搭 = 造型方案制作向导:个人信息完整性检查(4 类照片 +
身形参数,缺失引导去完善)+ 任务参数(日期范围/地点)+ 已有方案
- 我的 = 个人信息管理入口:用户卡片(昵称/会员状态)+ 我的形象 /
我的衣橱 / 会员中心入口 + 退出登录
- profile_page 移除退出登录(归「我的」页)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../core/auth/auth_provider.dart';
|
||||
import '../../features/member/member_provider.dart';
|
||||
|
||||
/// 我的:个人信息管理入口(形象 / 衣橱 / 会员)+ 退出登录
|
||||
class MinePage extends ConsumerWidget {
|
||||
const MinePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final auth = ref.watch(authProvider).value;
|
||||
final member = ref.watch(memberProvider).value;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
|
||||
final rawName = auth?.name?.trim() ?? '';
|
||||
final name = rawName.isEmpty ? '我的' : rawName;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('我的')),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
Card(
|
||||
color: scheme.primaryContainer.withValues(alpha: 0.4),
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: scheme.primary,
|
||||
child: Text(
|
||||
name.characters.first,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
title: Text(name,
|
||||
style: const TextStyle(
|
||||
fontSize: 17, fontWeight: FontWeight.bold)),
|
||||
subtitle: Text(
|
||||
member?.isVip == true
|
||||
? '形象会员 · ${member!.planName} · 有效期至 ${member.expireAt}'
|
||||
: '普通用户',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
|
||||
onTap: () => context.push('/commercial'),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Card(
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.face_retouching_natural),
|
||||
title: const Text('我的形象'),
|
||||
subtitle: const Text('3D 化身 · 形象照片 · 身形参数'),
|
||||
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
|
||||
onTap: () => context.push('/profile'),
|
||||
),
|
||||
const Divider(height: 1, indent: 56),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.checkroom),
|
||||
title: const Text('我的衣橱'),
|
||||
subtitle: const Text('管理服装单品,AI 生成时自动搭配'),
|
||||
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
|
||||
onTap: () => context.push('/wardrobe'),
|
||||
),
|
||||
const Divider(height: 1, indent: 56),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.workspace_premium),
|
||||
title: const Text('会员中心'),
|
||||
subtitle: const Text('会员权益 · 套餐充值 · 合作门店 · 最近优惠'),
|
||||
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
|
||||
onTap: () => context.push('/commercial'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () async {
|
||||
await ref.read(authProvider.notifier).logout();
|
||||
if (context.mounted) context.go('/login');
|
||||
},
|
||||
icon: const Icon(Icons.logout),
|
||||
label: const Text('退出登录'),
|
||||
style: OutlinedButton.styleFrom(foregroundColor: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user