Repository navigation
fix(shell): 优化预测性返回交互与公告弹层遮罩并修复空课表横屏溢出 - #59
Merged
airline233 merged 5 commits intoNov 26, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个 PR 做了什么
围绕 Android 预测性返回体验、弹层遮罩和横屏布局完成集中修复与优化:
miuix弹窗返回时 0ms 硬切;统一附件全屏预览及零散MaterialPageRoute路由转场,并补齐网页历史后退与日程编辑页未保存退出保护。改动了哪些代码
1. 壳布局与预测性返回转场
lib/core/layout/app_pane_layout.dart:AppPaneLayout.mediaForRect在面板未贴合窗口四边时显式写入BorderRadius.zero(而非置空),同时避免 Android API 31+ 透传物理屏幕圆角及手势中途回退到0 -> 32dp默认圆角插值。lib/core/navigation/app_navigation.dart、lib/shell/root_page.dart:在_PaneObserver中跟踪正在退场的页面路由(_exitingDetails)并暴露hasVisibleDetails,窄屏详情退出动画结束前保持底栏隐藏,避免动画中途高度变化导致重排;rebase 时完整保留上游topRouteInBranch。lib/core/navigation/app_page.dart:_AppPageBasedRoute保留directLaunch的Duration.zero瞬时入场,并在didPush()后恢复controller.duration,使取消预测性返回手势时平滑回弹。lib/core/theme.dart:PredictiveBackPageTransitionsBuilder显式设置fallbackColor: palette.pageBg,避免明暗主题下退场闪白。2. 底部弹层、Miuix 弹窗与页面返回保护
lib/core/ui/app_bottom_sheet.dart:新增showAppModalBottomSheet与AppModalBottomSheetRoute,接入flutter/backgesture,在返回手势期间对弹层主体执行底边中心缩放(不缩放遮罩层,遵守PopScope与AppNavigationController.isBackTarget)。lib/mini_apps/bulletin/bulletin_page.dart、lib/mini_apps/campus_map/campus_map_page.dart、lib/mini_apps/free_classroom/free_classroom_sheets.dart、lib/mini_apps/timetable/(timetable_apply_weeks_sheet.dart、timetable_change_alert.dart、timetable_color_picker.dart、timetable_course_detail_sheet.dart、timetable_course_form_sheets.dart、timetable_edit_scope_sheet.dart、timetable_export_page.dart、timetable_schedule_event_detail_sheet.dart、timetable_settings_page.dart、timetable_switcher_sheet.dart、timetable_week_grid.dart):全量迁移 19 处showModalBottomSheet至showAppModalBottomSheet。lib/core/ui/miuix_dialog.dart:_MiuixDialogPageState改为PopScope(canPop: false)统一经_close(null)播放退场动画,修复返回键 0ms 硬切;_MiuixOptionMenuPageState改用细粒度MediaQuery.sizeOf/paddingOf。lib/mini_apps/bulletin/bulletin_detail_page.dart、lib/mini_apps/bulletin/bulletin_attachment_preview_dialog.dart:附件全屏预览由showDialog+Dialog.fullscreen改为AppPageRoute(Android 端不设fullscreenDialog: true),支持预测性返回。lib/mini_apps/library/library_page.dart、lib/mini_apps/timetable/timetable_page.dart、lib/mini_apps/timetable/timetable_switcher_sheet.dart:4 处MaterialPageRoute统一替换为AppPageRoute。lib/mini_apps/web/mini_web_view_page.dart:同步维护 WebView 历史栈可后退状态,通过PopScope在可后退时拦截返回并执行网页回退。lib/mini_apps/timetable/timetable_schedule_event_edit_page.dart:补充_dirty脏态判断与_saving保存中保护,未保存退出前弹出放弃确认框。3. 公告弹窗遮罩与课表空状态横屏适配
lib/shell/announcement/announcement_overlay.dart、lib/shell/announcement/announcement_sheet.dart:openAnnouncements与showAnnouncementDialog显式解析根导航器(rootNavigatorKey.currentState ?? Navigator.of(context, rootNavigator: true))并以useRootNavigator: true弹出,使遮罩在宽窄屏及旋屏后均覆盖底部导航栏;同时避免localActions引用可能随宽窄切换卸载的铃铛上下文,并增加脱敏debug诊断日志。lib/mini_apps/timetable/timetable_page.dart:_EmptyState外层包裹LayoutBuilder+SingleChildScrollView+ConstrainedBox(minHeight: constraints.maxHeight),高屏维持居中布局、横屏矮窗可滚动不溢出。docs/architecture.md:更新公告弹窗导航器作用域及预测性返回相关说明。4. 测试与验证结果
test/app_bottom_sheet_test.dart、test/miuix_dialog_test.dart。test/wide_layout_test.dart、test/widget_test.dart、test/bulletin_attachment_preview_test.dart、test/timetable_course_edit_test.dart、test/timetable_page_test.dart,覆盖浅/深色下的顶角圆角、退场底栏重排时机、宽窄屏公告遮罩、附件预览/网页历史/日程编辑返回保护,以及横屏矮窗空课表滚动。main(7a5a8d8)的本地检查结果:dart format --output=none --set-exit-if-changed lib test:457 文件无差异,通过。flutter analyze:零问题,通过。cargo test --locked --target-dir ../../build/rust-host(native/vpn):37 passed,通过。flutter test:+2516 ~22 -2(~22为未传宿主机VPN_NATIVE_LIBRARY时默认跳过的 FFI 用例);本分支相关测试全绿,唯二失败项为上游7a5a8d8(feat(app-icon): 新增海海图标 (#58))自带的test/app_icon_test.dart中 2 条图标顺序断言(app_icon_models.dart将alt移至末尾但未同步更新测试),本 PR 未改动图标模块故保持上游原样。检查清单
dart format lib test无改动flutter analyze零警告flutter test全绿cargo test正常通过<type>(<scope>): <中文摘要>(type 与 scope 见 CONTRIBUTING.md)——前缀写错,改动会掉进 release notes 的 "Other Changes"