## 后台管理页重构 - admin 端: add_doctor / doctors / home / patients 四页重构 - doctor 端: consultations / dashboard / followup_edit / followups / home / patient_detail / patients / profile / report_detail / reports / settings 十一页重构 - 新增 backoffice 共享模块: backoffice_refresh_providers + backoffice_formatters + backoffice_ui ## 后端 - AdminService 增强(分页/搜索/统计) - doctor_endpoints 微调 - appsettings.Development 调整 - 新增 admin_service_tests ## 前端其他 - 今日健康卡片 taskRow 行高 5->7(每行 44->48px) - 健康仪表盘配色定 #4FACFE 纯色蓝 - admin_drawer / doctor_drawer 微调 - api_client IP 适配 ## 启动脚本 - start-dev.bat: 加后端就绪检测(轮询 openapi 端点, 最多等 30s) ## 清理 - 删除旧品牌图(agent_welcome_abstract / login_background_v1) - 删除 app_status_badge 组件 - 删除旧 HANDOFF 文档, 新增 07-17 版 ## 测试 - 新增 backoffice_formatters / backoffice_refresh / backoffice_ui 三个测试 - app_router_test 扩展
183 lines
5.8 KiB
Dart
183 lines
5.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../core/app_colors.dart';
|
|
import '../core/navigation_provider.dart';
|
|
import '../pages/admin/admin_home_page.dart' show adminPageProvider;
|
|
import '../providers/auth_provider.dart';
|
|
import 'drawer_shell.dart';
|
|
|
|
class AdminDrawer extends ConsumerWidget {
|
|
const AdminDrawer({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final currentPage = ref.watch(adminPageProvider);
|
|
|
|
return DrawerShell(
|
|
child: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
margin: const EdgeInsets.all(14),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withValues(alpha: 0.88),
|
|
borderRadius: BorderRadius.circular(22),
|
|
border: Border.all(
|
|
color: Colors.white.withValues(alpha: 0.86),
|
|
width: 1.2,
|
|
),
|
|
boxShadow: AppColors.cardShadowLight,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 56,
|
|
height: 56,
|
|
decoration: BoxDecoration(
|
|
gradient: AppColors.primaryGradient,
|
|
borderRadius: BorderRadius.circular(20),
|
|
boxShadow: AppColors.buttonShadow,
|
|
),
|
|
child: const Icon(
|
|
Icons.admin_panel_settings,
|
|
size: 28,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
const Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'系统管理员',
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
SizedBox(height: 3),
|
|
Text(
|
|
'医生与患者管理',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: AppColors.textSecondary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
_MenuItem(
|
|
icon: Icons.local_hospital,
|
|
label: '医生管理',
|
|
selected: currentPage == 'doctors',
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
ref.read(adminPageProvider.notifier).set('doctors');
|
|
},
|
|
),
|
|
_MenuItem(
|
|
icon: Icons.people_outline,
|
|
label: '患者列表',
|
|
selected: currentPage == 'patients',
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
ref.read(adminPageProvider.notifier).set('patients');
|
|
},
|
|
),
|
|
const Spacer(),
|
|
const Divider(height: 1, color: AppColors.divider),
|
|
const SizedBox(height: 8),
|
|
_MenuItem(
|
|
icon: Icons.logout,
|
|
label: '退出登录',
|
|
danger: true,
|
|
onTap: () async {
|
|
Navigator.pop(context);
|
|
await ref.read(authProvider.notifier).logout();
|
|
goRoute(ref, 'login');
|
|
},
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _MenuItem extends StatelessWidget {
|
|
final IconData icon;
|
|
final String label;
|
|
final VoidCallback onTap;
|
|
final bool selected;
|
|
final bool danger;
|
|
const _MenuItem({
|
|
required this.icon,
|
|
required this.label,
|
|
required this.onTap,
|
|
this.selected = false,
|
|
this.danger = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final color = danger
|
|
? AppColors.error
|
|
: selected
|
|
? const Color(0xFF7C5CFF)
|
|
: AppColors.textPrimary;
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
|
|
child: Material(
|
|
color: Colors.transparent,
|
|
borderRadius: BorderRadius.circular(14),
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(14),
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
decoration: BoxDecoration(
|
|
gradient: selected
|
|
? AppColors.primaryGradient
|
|
: AppColors.surfaceGradient,
|
|
borderRadius: BorderRadius.circular(14),
|
|
border: Border.all(
|
|
color: selected
|
|
? Colors.white.withValues(alpha: 0.80)
|
|
: AppColors.borderLight,
|
|
width: 1.1,
|
|
),
|
|
boxShadow: selected
|
|
? AppColors.buttonShadow
|
|
: AppColors.cardShadowLight,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, color: selected ? Colors.white : color, size: 20),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w700,
|
|
color: selected ? Colors.white : color,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|