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:
@@ -74,11 +74,28 @@ class _BootGateState extends ConsumerState<_BootGate> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_startTimeout();
|
||||
}
|
||||
|
||||
void _startTimeout() {
|
||||
_timer?.cancel();
|
||||
_timer = Timer(const Duration(seconds: 8), () {
|
||||
if (mounted) setState(() => _timedOut = true);
|
||||
});
|
||||
}
|
||||
|
||||
void _handleReadyChanged(bool? previous, bool ready) {
|
||||
if (ready) {
|
||||
_timer?.cancel();
|
||||
if (_timedOut) setState(() => _timedOut = false);
|
||||
return;
|
||||
}
|
||||
if (previous != false) {
|
||||
if (_timedOut) setState(() => _timedOut = false);
|
||||
_startTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_timer?.cancel();
|
||||
@@ -87,6 +104,7 @@ class _BootGateState extends ConsumerState<_BootGate> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ref.listen<bool>(appReadyProvider, _handleReadyChanged);
|
||||
final ready = ref.watch(appReadyProvider) || _timedOut;
|
||||
return Stack(
|
||||
children: [
|
||||
@@ -135,9 +153,21 @@ class _RootNavigator extends ConsumerWidget {
|
||||
}
|
||||
|
||||
return PopScope(
|
||||
canPop: stack.length <= 1,
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
if (!didPop) popRoute(ref);
|
||||
if (didPop) return;
|
||||
if (stack.length > 1) {
|
||||
popRoute(ref);
|
||||
return;
|
||||
}
|
||||
final homeRoute = switch (authState.user?.role) {
|
||||
'Admin' => 'adminHome',
|
||||
'Doctor' => 'doctorHome',
|
||||
_ => 'home',
|
||||
};
|
||||
if (current.name != homeRoute && authState.isLoggedIn) {
|
||||
goRoute(ref, homeRoute);
|
||||
}
|
||||
},
|
||||
child: Navigator(
|
||||
pages: [
|
||||
@@ -148,8 +178,12 @@ class _RootNavigator extends ConsumerWidget {
|
||||
child: buildPage(stack[index], ref),
|
||||
),
|
||||
],
|
||||
onDidRemovePage: (_) {
|
||||
if (ref.read(routeStackProvider).length > 1) popRoute(ref);
|
||||
onDidRemovePage: (page) {
|
||||
final routes = ref.read(routeStackProvider);
|
||||
if (routes.length <= 1) return;
|
||||
final lastIndex = routes.length - 1;
|
||||
final currentPageKey = ValueKey(_pageKey(routes.last, lastIndex));
|
||||
if (page.key == currentPageKey) popRoute(ref);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user