Files
AI-Health/health_app/lib/pages/admin/admin_home_page.dart
MingNian 0d4fd88ce7 feat: 三端抽屉重构 + 配色系统更新 + 后台管理页精调 + 键盘抬起组件
## 抽屉重构
- admin_drawer / doctor_drawer / health_drawer 三端抽屉全部重做
- drawer_shell 增强

## 配色系统
- app_colors / app_module_visuals / app_theme 更新
- app.dart 启动流程调整

## 后台管理页
- admin_doctors_page 大幅重构(+251)
- admin_home / doctor_dashboard / doctor_reports / doctor_home / doctor_followups / doctor_settings 精调

## 患者端
- home_page / chat_messages_view / medication_list / notification_center / remaining_pages / exercise_plan / device / diet / consultation 微调

## 新增
- keyboard_lift.dart: 键盘抬起处理组件
- AGENTS.md: agent 指引文档

## 其他
- api_client IP 适配
- app_future_view 增强
- data_providers 调整
- secondary_page_visuals_test 更新
2026-07-19 19:11:30 +08:00

65 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../core/app_colors.dart';
import '../../widgets/admin_drawer.dart';
import '../../widgets/backoffice_ui.dart';
import 'admin_doctors_page.dart';
import 'admin_patients_page.dart';
final adminPageProvider = NotifierProvider<AdminPageNotifier, String>(
AdminPageNotifier.new,
);
class AdminPageNotifier extends Notifier<String> {
@override
String build() => 'doctors';
void set(String page) => state = page;
}
class AdminHomePage extends ConsumerStatefulWidget {
const AdminHomePage({super.key});
@override
ConsumerState<AdminHomePage> createState() => _AdminHomePageState();
}
class _AdminHomePageState extends ConsumerState<AdminHomePage> {
final List<Widget?> _pages = [const AdminDoctorsPage(), null];
@override
Widget build(BuildContext context) {
final page = ref.watch(adminPageProvider);
final pageIndex = page == 'patients' ? 1 : 0;
_pages[pageIndex] ??= const AdminPatientsPage();
return PopScope(
canPop: page == 'doctors',
onPopInvokedWithResult: (didPop, _) {
if (!didPop) ref.read(adminPageProvider.notifier).set('doctors');
},
child: Scaffold(
backgroundColor: AppColors.pageGrey,
drawerEnableOpenDragGesture: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Text(
page == 'patients' ? '患者管理' : '医生管理',
style: TextStyle(color: AppColors.textPrimary),
),
iconTheme: const IconThemeData(color: AppColors.textPrimary),
),
drawer: const AdminDrawer(),
body: BackofficeSurface(
child: IndexedStack(
index: pageIndex,
children: _pages
.map((page) => page ?? const SizedBox.shrink())
.toList(growable: false),
),
),
),
);
}
}