gcx/frontend/admin-app/lib/features/settings/presentation/pages/settings_page.dart

191 lines
6.6 KiB
Dart

import 'package:flutter/material.dart';
import '../../../../app/theme/app_colors.dart';
import '../../../../app/router.dart';
/// 发行方设置页面(我的)
///
/// 企业信息、门店管理、员工管理、专属客服、安全设置
class SettingsPage extends StatelessWidget {
const SettingsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('我的')),
body: SingleChildScrollView(
child: Column(
children: [
// Profile Card
_buildProfileCard(context),
// Tier & Benefits
_buildTierCard(context),
const SizedBox(height: 8),
// Menu Groups
_buildMenuGroup('企业管理', [
_MenuItem('企业信息', Icons.business_rounded, () {
// TODO: Navigate to company info page when available
}),
_MenuItem('门店管理', Icons.store_rounded, () {
Navigator.pushNamed(context, AppRouter.storeManagement);
}),
_MenuItem('员工管理', Icons.people_rounded, () {
Navigator.pushNamed(context, AppRouter.storeManagement);
}),
_MenuItem('权限设置', Icons.admin_panel_settings_rounded, () {
// TODO: Navigate to permissions page when available
}),
]),
_buildMenuGroup('服务支持', [
_MenuItem('AI 助手', Icons.auto_awesome_rounded, () {
Navigator.pushNamed(context, AppRouter.aiAgent);
}),
_MenuItem('专属客服', Icons.headset_mic_rounded, () {
// TODO: Navigate to customer service page when available
}),
_MenuItem('帮助中心', Icons.help_outline_rounded, () {
// TODO: Navigate to help center page when available
}),
_MenuItem('意见反馈', Icons.feedback_rounded, () {
// TODO: Navigate to feedback page when available
}),
]),
_buildMenuGroup('安全与账号', [
_MenuItem('修改密码', Icons.lock_outline_rounded, () {
// TODO: Navigate to change password page when available
}),
_MenuItem('操作日志', Icons.history_rounded, () {
// TODO: Navigate to operation log page when available
}),
_MenuItem('关于 Genex', Icons.info_outline_rounded, () {
// TODO: Navigate to about page when available
}),
]),
// Logout
Padding(
padding: const EdgeInsets.all(20),
child: SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: () {
Navigator.pushNamedAndRemoveUntil(context, AppRouter.login, (_) => false);
},
style: OutlinedButton.styleFrom(
foregroundColor: AppColors.error,
side: const BorderSide(color: AppColors.error),
),
child: const Text('退出登录'),
),
),
),
],
),
),
);
}
Widget _buildProfileCard(BuildContext context) {
return Container(
padding: const EdgeInsets.fromLTRB(20, 20, 20, 16),
color: AppColors.surface,
child: Row(
children: [
Container(
width: 56,
height: 56,
decoration: BoxDecoration(
gradient: AppColors.primaryGradient,
borderRadius: BorderRadius.circular(14),
),
child: const Icon(Icons.storefront_rounded, color: Colors.white, size: 28),
),
const SizedBox(width: 14),
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Starbucks China', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700)),
SizedBox(height: 4),
Text('管理员:张经理', style: TextStyle(fontSize: 13, color: AppColors.textSecondary)),
],
),
),
const Icon(Icons.chevron_right_rounded, color: AppColors.textTertiary),
],
),
);
}
Widget _buildTierCard(BuildContext context) {
return Container(
margin: const EdgeInsets.fromLTRB(20, 12, 20, 0),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFFFFF7E6), Color(0xFFFFECC7)],
),
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
const Icon(Icons.star_rounded, color: AppColors.tierGold, size: 28),
const SizedBox(width: 12),
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('黄金发行方', style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: AppColors.tierGold)),
Text('手续费率 1.2% · 高级数据分析', style: TextStyle(fontSize: 12, color: AppColors.textSecondary)),
],
),
),
TextButton(
onPressed: () {
Navigator.pushNamed(context, AppRouter.credit);
},
child: const Text('升级', style: TextStyle(color: AppColors.tierGold)),
),
],
),
);
}
Widget _buildMenuGroup(String title, List<_MenuItem> items) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(20, 20, 20, 8),
child: Text(title, style: const TextStyle(fontSize: 13, color: AppColors.textTertiary, fontWeight: FontWeight.w500)),
),
Container(
color: AppColors.surface,
child: Column(
children: items.map((item) {
return ListTile(
leading: Icon(item.icon, color: AppColors.textSecondary, size: 22),
title: Text(item.title, style: const TextStyle(fontSize: 15)),
trailing: const Icon(Icons.chevron_right_rounded, size: 20, color: AppColors.textTertiary),
onTap: item.onTap,
);
}).toList(),
),
),
],
);
}
}
class _MenuItem {
final String title;
final IconData icon;
final VoidCallback onTap;
const _MenuItem(this.title, this.icon, this.onTap);
}