## 抽屉重构 - 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 更新
97 lines
2.6 KiB
Dart
97 lines
2.6 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
Future<void> runAfterDrawerClose(
|
|
BuildContext context,
|
|
FutureOr<void> Function() action,
|
|
) async {
|
|
Navigator.of(context).pop();
|
|
await action();
|
|
}
|
|
|
|
Future<bool> confirmAccountAction(
|
|
BuildContext context, {
|
|
required String title,
|
|
required String message,
|
|
required String confirmLabel,
|
|
}) async {
|
|
return await showDialog<bool>(
|
|
context: context,
|
|
builder: (dialogContext) => AlertDialog(
|
|
title: Text(title),
|
|
content: Text(message),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(dialogContext, false),
|
|
child: const Text('取消'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(dialogContext, true),
|
|
child: Text(
|
|
confirmLabel,
|
|
style: const TextStyle(color: Colors.red),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
) ??
|
|
false;
|
|
}
|
|
|
|
class DrawerShell extends StatelessWidget {
|
|
final double widthFactor;
|
|
final Widget child;
|
|
final bool showBackground;
|
|
|
|
const DrawerShell({
|
|
super.key,
|
|
required this.child,
|
|
this.widthFactor = 0.78,
|
|
this.showBackground = true,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Drawer(
|
|
width: MediaQuery.sizeOf(context).width * widthFactor,
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0,
|
|
child: ClipRRect(
|
|
borderRadius: const BorderRadius.horizontal(right: Radius.circular(28)),
|
|
child: Stack(
|
|
children: [
|
|
if (showBackground) ...[
|
|
Positioned.fill(
|
|
child: Image.asset(
|
|
'assets/branding/drawer_background_v1.png',
|
|
fit: BoxFit.cover,
|
|
alignment: Alignment.centerLeft,
|
|
),
|
|
),
|
|
Positioned.fill(
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Colors.white.withValues(alpha: 0.12),
|
|
Colors.white.withValues(alpha: 0.42),
|
|
Colors.white.withValues(alpha: 0.72),
|
|
],
|
|
stops: const [0.0, 0.48, 1.0],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
] else
|
|
const Positioned.fill(child: ColoredBox(color: Colors.white)),
|
|
child,
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|