帮助与反馈页面开发

This commit is contained in:
2026-10-10 08:47:30 +08:00
parent 208147cdf2
commit 167229371f
3 changed files with 806 additions and 81 deletions

View File

@@ -19,6 +19,7 @@ import 'package:maibu_satabot_v2/features/v2/my/presentation/widgets/quick_actio
import 'package:maibu_satabot_v2/features/v2/my/presentation/widgets/menu_item_card.dart';
import 'package:maibu_satabot_v2/features/v2/my/presentation/pages/system_settings_page.dart';
import 'package:maibu_satabot_v2/features/v2/my/presentation/pages/profile_detail_page.dart';
import 'package:maibu_satabot_v2/features/v2/my/presentation/pages/help_feedback_page.dart';
/// 我的页面(100% 还原设计稿)
class MyPage extends StatelessWidget {
@@ -75,90 +76,91 @@ class _MyPageContent extends StatelessWidget {
return SingleChildScrollView(
child: Column(
children: [
// 用户信息卡片(延伸到状态栏)
UserProfileCard(
name: userName,
role: userRole,
avatar: user?.avatar,
onTap: () {
// 跳转到个人信息详情页
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ProfileDetailPage(),
),
);
},
),
// 快捷入口卡片(负margin向上重叠)
Transform.translate(
offset: const Offset(0, -15),
child: QuickActionCard(
onMessageTap: () {
debugPrint('我的消息');
},
onFavoriteTap: () {
debugPrint('我的收藏');
},
onWorkOrderTap: () {
debugPrint('我的工单');
},
),
),
// 菜单列表(白色卡片)
Container(
margin: const EdgeInsets.only(
top: 15,
left: 16,
right: 16,
bottom: 16,
),
decoration: BoxDecoration(
color: context.appColors.cardBackground,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: context.appColors.cardShadow,
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
// 末尾追加退出登录,占据“关于我们”原来的位置
itemCount: state.menuItems.length + 1,
itemBuilder: (context, index) {
// 退出登录(列表最后一项,在可滚动区域内避免底部溢出)
if (index == state.menuItems.length) {
return _buildLogoutButton(context);
}
final item = state.menuItems[index];
// 🔥 夜间模式开关值以全局 ThemeCubit 状态为准
final displayItem = item.id == 'night_mode'
? item.copyWith(switchValue: isDarkMode)
: item;
return MenuItemCard(
item: displayItem,
onTap: () => _handleMenuItemTap(context, cubit, item),
onSwitchChanged: item.hasSwitch
? (value) {
// 更新菜单 UI 状态
cubit.toggleNightMode(value);
// 🔥 真正切换全局主题
context
.read<ThemeCubit>()
.toggleDarkMode(value);
}
: null,
children: [
// 用户信息卡片(延伸到状态栏)
UserProfileCard(
name: userName,
role: userRole,
avatar: user?.avatar,
onTap: () {
// 跳转到个人信息详情页
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ProfileDetailPage(),
),
);
},
),
),
],
// 快捷入口卡片(负margin向上重叠)
Transform.translate(
offset: const Offset(0, -15),
child: QuickActionCard(
onMessageTap: () {
debugPrint('我的消息');
},
onFavoriteTap: () {
debugPrint('我的收藏');
},
onWorkOrderTap: () {
debugPrint('我的工单');
},
),
),
// 菜单列表(白色卡片)
Container(
margin: const EdgeInsets.only(
top: 15,
left: 16,
right: 16,
bottom: 16,
),
decoration: BoxDecoration(
color: context.appColors.cardBackground,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: context.appColors.cardShadow,
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
// 末尾追加退出登录,占据“关于我们”原来的位置
itemCount: state.menuItems.length + 1,
itemBuilder: (context, index) {
// 退出登录(列表最后一项,在可滚动区域内避免底部溢出)
if (index == state.menuItems.length) {
return _buildLogoutButton(context);
}
final item = state.menuItems[index];
// 🔥 夜间模式开关值以全局 ThemeCubit 状态为准
final displayItem = item.id == 'night_mode'
? item.copyWith(switchValue: isDarkMode)
: item;
return MenuItemCard(
item: displayItem,
onTap: () =>
_handleMenuItemTap(context, cubit, item),
onSwitchChanged: item.hasSwitch
? (value) {
// 更新菜单 UI 状态
cubit.toggleNightMode(value);
// 🔥 真正切换全局主题
context.read<ThemeCubit>().toggleDarkMode(
value,
);
}
: null,
);
},
),
),
],
),
);
}
@@ -196,6 +198,13 @@ class _MyPageContent extends StatelessWidget {
MaterialPageRoute(builder: (context) => const SystemSettingsPage()),
);
break;
case 'help_feedback':
// 跳转到帮助与反馈页面
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const HelpFeedbackPage()),
);
break;
default:
debugPrint('点击菜单: ${item.title}');
// TODO: 根据 ID 跳转到对应页面