Polish health app UI

This commit is contained in:
MingNian
2026-06-26 14:37:17 +08:00
parent 86c7957144
commit df37076c46
46 changed files with 717 additions and 514 deletions

View File

@@ -4,6 +4,7 @@ import '../core/app_colors.dart';
import '../core/navigation_provider.dart';
import '../providers/auth_provider.dart';
import '../pages/doctor/doctor_home_page.dart' show doctorPageProvider;
import 'drawer_shell.dart';
class DoctorDrawer extends ConsumerWidget {
const DoctorDrawer({super.key});
@@ -14,94 +15,90 @@ class DoctorDrawer extends ConsumerWidget {
final currentPage = ref.watch(doctorPageProvider);
final name = auth.user?.name ?? '医生';
return Drawer(
width: MediaQuery.of(context).size.width * 0.8,
child: Container(
decoration: const BoxDecoration(gradient: AppColors.drawerGradient),
child: SafeArea(
child: Column(
children: [
_DrawerHeader(
name: name,
subtitle: '点击完善医生信息',
icon: Icons.medical_services_outlined,
onTap: () {
Navigator.pop(context);
pushRoute(ref, 'doctorProfile');
},
),
const SizedBox(height: 8),
_DrawerItem(
icon: Icons.dashboard_outlined,
label: '工作台',
selected: currentPage == 'dashboard',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('dashboard');
},
),
_DrawerItem(
icon: Icons.people_outline,
label: '患者管理',
selected: currentPage == 'patients',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('patients');
},
),
_DrawerItem(
icon: Icons.chat_outlined,
label: '问诊列表',
selected: currentPage == 'consultations',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('consultations');
},
),
_DrawerItem(
icon: Icons.description_outlined,
label: '报告审核',
selected: currentPage == 'reports',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('reports');
},
),
_DrawerItem(
icon: Icons.event_note_outlined,
label: '复查随访',
selected: currentPage == 'followups',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('followups');
},
),
const Spacer(),
const Divider(height: 1, color: AppColors.divider),
const SizedBox(height: 8),
_DrawerItem(
icon: Icons.settings_outlined,
label: '设置',
selected: false,
onTap: () {
Navigator.pop(context);
pushRoute(ref, 'doctorSettings');
},
),
_DrawerItem(
icon: Icons.logout,
label: '退出登录',
selected: false,
danger: true,
onTap: () async {
Navigator.pop(context);
await ref.read(authProvider.notifier).logout();
goRoute(ref, 'login');
},
),
const SizedBox(height: 16),
],
),
return DrawerShell(
child: SafeArea(
child: Column(
children: [
_DrawerHeader(
name: name,
subtitle: '点击完善医生信息',
icon: Icons.medical_services_outlined,
onTap: () {
Navigator.pop(context);
pushRoute(ref, 'doctorProfile');
},
),
const SizedBox(height: 8),
_DrawerItem(
icon: Icons.dashboard_outlined,
label: '工作台',
selected: currentPage == 'dashboard',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('dashboard');
},
),
_DrawerItem(
icon: Icons.people_outline,
label: '患者管理',
selected: currentPage == 'patients',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('patients');
},
),
_DrawerItem(
icon: Icons.chat_outlined,
label: '问诊列表',
selected: currentPage == 'consultations',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('consultations');
},
),
_DrawerItem(
icon: Icons.description_outlined,
label: '报告审核',
selected: currentPage == 'reports',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('reports');
},
),
_DrawerItem(
icon: Icons.event_note_outlined,
label: '复查随访',
selected: currentPage == 'followups',
onTap: () {
Navigator.pop(context);
ref.read(doctorPageProvider.notifier).set('followups');
},
),
const Spacer(),
const Divider(height: 1, color: AppColors.divider),
const SizedBox(height: 8),
_DrawerItem(
icon: Icons.settings_outlined,
label: '设置',
selected: false,
onTap: () {
Navigator.pop(context);
pushRoute(ref, 'doctorSettings');
},
),
_DrawerItem(
icon: Icons.logout,
label: '退出登录',
selected: false,
danger: true,
onTap: () async {
Navigator.pop(context);
await ref.read(authProvider.notifier).logout();
goRoute(ref, 'login');
},
),
const SizedBox(height: 16),
],
),
),
);
@@ -126,10 +123,13 @@ class _DrawerHeader extends StatelessWidget {
margin: const EdgeInsets.all(14),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
gradient: AppColors.softGlassGradient,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: AppColors.borderLight),
boxShadow: AppColors.cardShadow,
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: InkWell(
onTap: onTap,
@@ -137,11 +137,11 @@ class _DrawerHeader extends StatelessWidget {
child: Row(
children: [
Container(
width: 52,
height: 52,
width: 56,
height: 56,
decoration: BoxDecoration(
gradient: AppColors.doctorGradient,
borderRadius: BorderRadius.circular(18),
borderRadius: BorderRadius.circular(20),
boxShadow: AppColors.buttonShadow,
),
child: Icon(icon, color: Colors.white, size: 26),
@@ -198,7 +198,7 @@ class _DrawerItem extends StatelessWidget {
final color = danger
? AppColors.error
: selected
? AppColors.primary
? const Color(0xFF7C5CFF)
: AppColors.textPrimary;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
@@ -212,13 +212,14 @@ class _DrawerItem extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
decoration: BoxDecoration(
gradient: selected
? AppColors.primaryGradient
? AppColors.doctorGradient
: AppColors.surfaceGradient,
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: selected
? AppColors.primaryLight
? Colors.white.withValues(alpha: 0.80)
: AppColors.borderLight,
width: 1.1,
),
boxShadow: selected
? AppColors.buttonShadow