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 更新
This commit is contained in:
@@ -24,23 +24,9 @@ class MedicationListPage extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _MedicationListPageState extends ConsumerState<MedicationListPage> {
|
||||
Future<List<Map<String, dynamic>>>? _future;
|
||||
final Set<String> _deleting = {};
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
void _load() => setState(() {
|
||||
_future = ref.read(medicationServiceProvider).getMedications('');
|
||||
});
|
||||
|
||||
Future<void> _refresh() async {
|
||||
_load();
|
||||
await _future;
|
||||
}
|
||||
Future<void> _refresh() => ref.refresh(medicationListProvider.future);
|
||||
|
||||
Future<void> _confirmDelete(String id, String name) async {
|
||||
if (id.isEmpty || _deleting.contains(id)) return;
|
||||
@@ -68,7 +54,6 @@ class _MedicationListPageState extends ConsumerState<MedicationListPage> {
|
||||
await ref.read(medicationServiceProvider).deleteMedication(id);
|
||||
ref.invalidate(medicationListProvider);
|
||||
ref.invalidate(medicationReminderProvider);
|
||||
_load();
|
||||
if (mounted) AppToast.show(context, '用药已删除', type: AppToastType.success);
|
||||
} catch (error) {
|
||||
if (mounted) {
|
||||
@@ -97,9 +82,9 @@ class _MedicationListPageState extends ConsumerState<MedicationListPage> {
|
||||
tooltip: '添加用药',
|
||||
onPressed: () => pushRoute(ref, 'medicationEdit'),
|
||||
),
|
||||
body: AppFutureView<List<Map<String, dynamic>>>(
|
||||
future: _future,
|
||||
onRetry: _load,
|
||||
body: AppAsyncValueView<List<Map<String, dynamic>>>(
|
||||
value: ref.watch(medicationListProvider),
|
||||
onRetry: () => ref.invalidate(medicationListProvider),
|
||||
errorTitle: '用药信息加载失败',
|
||||
onData: (_, medications) {
|
||||
if (medications.isEmpty) {
|
||||
|
||||
Reference in New Issue
Block a user