视频全屏时自动隐藏原生标题栏 - #2591
视频全屏时自动隐藏原生标题栏#2591OliverArcher wants to merge 3 commits into
Conversation
Added methods to hide and restore the title bar during fullscreen mode for Windows and Linux.
Removed the showWindowButton variable and its related settings section for desktop.
| static const showWindowButton = SettingKey<bool>( | ||
| _SettingBoxKey.showWindowButton, | ||
| false, | ||
| true, |
There was a problem hiding this comment.
WARNING: Flipping this default changes behavior for existing users too — including macOS — and there is no longer a way to change it back
GStorage.getSetting returns the default whenever nothing is stored, so this isn't only a new-install change. Any existing user who never touched the toggle goes from false to true after upgrading:
- Windows/Linux: the native title bar comes back, and the in-app
CloseButtoninSysAppBar(lib/bean/appbar/sys_app_bar.dart:36) andpopular_page.dart:250disappears. - macOS:
main.dart:84now passeswindowButtonVisibility: true, so the native traffic-light buttons show up.SysAppBar.preferredSize/info_page.dart:366-374also add a 22px top offset. That goes against the PR description's claim that macOS behavior is unchanged.
theme_settings_page.dart also removes the "使用系统标题栏" toggle. So neither these upgraded users nor anyone who set it manually can change the preference in the UI anymore; the key is only reachable through settings import/export. Options: keep the toggle, only apply the new default to fresh installs (e.g. a migration that stores false for existing installs), or keep macOS on its old behavior.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (3 files)
Fix these issues in Kilo Cloud Reviewed by claude-opus-5.5 · Input: 0 · Output: 0 · Cached: 0 |
TL;DR
Windows 与 Linux 上,原生标题栏会在窗口进入全屏时压在画面顶部、退出全屏后行为又跟用户偏好对不上。这个 PR 让标题栏在进入全屏前自动隐藏、退出全屏后按用户偏好恢复。macOS 上原生标题栏本就永远隐藏,所以这两个调用是 no-op,行为不变。
改动
三处文件改动,最小化补丁:
lib/services/platform/display_mode_service.dart:在applyVideoFullscreen(true)之前调setTitleBarStyle(hidden),在applyVideoFullscreen(false)之后按showWindowButton偏好恢复(macOS 走defaultTargetPlatform == macOS的旁路,永远 hidden)。新拆出的两个私有方法_hideTitleBarForFullscreen()/_restoreTitleBarAfterFullscreen()跟现有_attempt()错误处理一致。2.3.6 把enter/exitFullScreen重写成了单参数的applyVideoFullscreen(bool),本补丁跟着这套新签名走,并切到defaultTargetPlatform而不是Platform.isXxx,跟同文件其他判断风格一致。lib/services/storage/settings_keys.dart:showWindowButton的默认值从false改成true,让全新安装的用户默认显示标题栏(也就是说不打开全屏时看得见标题栏、进入全屏时自动隐藏)。lib/pages/settings/theme_settings_page.dart:删掉"外观 → 使用系统标题栏"那一段设置入口,连同showWindowButton字段和 initState 读取都删掉。代码仍然读showWindowButton,所以已经手动设过false的旧用户继续保留隐藏。为什么不留在设置里
showWindowButton这个开关之前只是用来选要不要显示原生标题栏,对全屏行为没有影响。把它从设置里挪走、把默认值反过来、并把全屏前后逻辑写进代码之后,全屏体验是统一的,没有用户能选错。showWindowButton这个 setting key 保留,所有现有用户数据不受影响。验证
flutter build windows --release干净通过。setTitleBarStyle是 no-op,行为不变。适用范围
补丁基线是 2.3.6。如果
display_mode_service.dart或settings_keys.dart后续重构,本补丁需要相应迁移。