Repository navigation
Feat/sync: Upstream 2.1.2 - #170
Merged
Merged
Conversation
Signed-off-by: dom <githubaccount56556@proton.me>
Signed-off-by: dom <githubaccount56556@proton.me>
…#2655) 二级评论新增独立排序设置(设置-其他设置-二级评论展示),默认按时间排序,避免热度排序下对话链断裂(回复者排在被回复者前面)。一级评论排序不受影响,与官方楼中楼行为一致。 Co-authored-by: Meteor-3 <meteor3@users.noreply.github.com>
* Add Command-R refresh for macOS recommendations * Fix macOS recommendation refresh shortcut handling
* feat: font utils * feat: font setting page
Signed-off-by: dom <githubaccount56556@proton.me>
Signed-off-by: dom <githubaccount56556@proton.me>
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.
跟进上游 2.1.2(
17e92c470)一、逐提交处置
a33284dec5fc313889pubspec.lock,依赖按鸿蒙自己的 pin 走0b7a58d9c867bf6bd453269d9f9efe03c647Platform.isMacOS守卫,鸿蒙无副作用,跟了少一份漂移)4ca0373451b9130eebaa8f650b817e92c470实测核验(逐 hunk 在最终工作区里找 after 文本):除
4ca037345外全部 100% 落地;报 N/A 的 hunk 都是鸿蒙侧上下文不同导致的匹配失败,已逐条 grep 确认代码确实在(dart:math/math.max、addHandler/removeHandler/_handleKeyEvent/refreshRecommendations、utils.dartimport/logoutAccount/removeAccounts)。二、
4ca037345 feat: font setting page的取舍上游把「App字体字重」「字体大小」两个入口合并成一个
/fontSetting页面,并新增系统字体族选择。改动 13 个文件,含一个 5771 行的lib/utils/fontconfig.g.dart。跟进的部分
pages/setting/pages/font_setting.dartutils/fontconfig.g.dartdart:ffi,原样pages/setting/models/style_settings.dartrouter/app_pages.dart/fontSizeSetting→/fontSettingutils/storage_key.dart、storage_pref.dartappFontpubspec.yamlffi: ^2.2.0(pubspec.lock因此只多 1 行改动)android/.../AndroidHelper.javapages/setting/pages/font_size_select.dart改写的部分:
lib/utils/font_utils.dart上游三条实现分支,鸿蒙只留 Linux 一条:
AndroidHelper.fontFamilies()。鸿蒙分支没有jni依赖,lib/utils/android/bindings.g.dart是手写的空实现存根,硬跟就得伪造JArray/JString/toDartString(releaseOriginal:)一整套假 API,得不偿失。win326.4.0 的 API(GetDC(null)、LPARAM(0)、ReleaseDC(null, hdc))。鸿蒙dependency_overrides把 win32 钉在 5.5.3(鸿蒙化插件链的要求,flutter pub get输出里明确写着win32 5.5.3 (overridden)),两者 API 不兼容,实测 4 个argument_type_not_assignable/extra_positional_arguments编译错误。win32 的 override 哪天放开了,把上游那两段抄回来即可,文件头有注释。结果:鸿蒙上
FontUtils.getFont()返回空集合,而font_setting.dart里本来就有if (_fonts.isNotEmpty)守卫,所以字体下拉框不会出现,页面只剩字重和字号——这两项在鸿蒙上完全可用,且比原来两个分散入口好用(带实时预览)。将来若接了 ArkTS 侧的字体枚举通道,在font_utils.dart里补一条_initHarmony()就能启用。手工解决的部分:
lib/utils/theme_utils.dart鸿蒙这个文件早就大幅偏离:字重在
appFontWeight == -1时跟随系统(HarmonyChannel.systemFontWeightScale分区间映射),字体族恒为HarmonyOS Sans/ 内置的HarmonyOS_Sans。上游这次要把用户自选的Pref.appFont接进 textTheme。处置:
Pref.appFont ?? (useBuiltInFont ? "HarmonyOS_Sans" : "HarmonyOS Sans")——鸿蒙上appFont恒为 null(枚举不到,下拉框都不出现),行为与改动前完全一致;本仓库的 Linux 构建上则由用户选择覆盖;changeStyle(font 与 fontWeight 都为 null 时把 textTheme 整个置 null 的短路优化)不采纳——鸿蒙的fontFamily永不为 null,这个短路恒不成立,保留鸿蒙原本的无条件写法更直白;appBarTheme.titleTextStyle和dialogTheme.titleTextStyle里,上游新增的fontFamily: font和鸿蒙已有的fontFamily: fontFamily被 git 拼到了同一个TextStyle(...)里。git 没报冲突。未跟进:
lib/utils/android/bindings.g.dart上游给它加了 31 行
fontFamilies()的 JNI 绑定。鸿蒙保留自己的 43 行空实现存根(git checkout --ours)。注意这个文件在鸿蒙的analysis_options.yaml里不排除(上游排除了),是刻意的——存根必须保持能通过分析。三、其余冲突的处置
git merge报了 6 个冲突:pubspec.yamlffi: ^2.2.0;版本号不动pubspec.lockflutter pub get重解,净变化 1 行(ffi 由 transitive 变 direct main)lib/utils/android/bindings.g.dartlib/utils/theme_utils.dartlib/pages/main/view.dart_nativeTabsWorker/_nativeTopBarWorker+ 上游的 macOS 键盘 handler)lib/pages/setting/view.dart四、附带修复:悬浮底栏被拉满整屏宽(独立提交,不在 merge 里)
现象
设置里开「悬浮底栏」后,鸿蒙上底栏横向撑满整屏,安卓上是正常的居中胶囊。
根因
FloatingNavigationBar内部是SizedBox(width: destinations.length * 86),必须拿到松的宽度约束才能保持自身宽度。该文件与上游 2.1.2 字节一致,问题不在控件里,在外面怎么给约束。上游从
e89241109 opt ui(2026-07-30)起把主页布局换成了自绘的MainLayout:松约束 + 手动水平居中,所以安卓是对的。鸿蒙没跟进这个骨架重构,仍然走
Scaffold.bottomNavigationBar,而 Scaffold 给这个 slot 下发的是:宽度是紧约束,
SizedBox的 258 被BoxConstraints.enforce夹成整屏宽。为什么不直接跟进
MainLayout它会整个替掉
Scaffold,而鸿蒙有几样东西挂在上面:零高 AppBar(状态栏取色的依赖,代码里有注释「Flutter 在鸿蒙平台上的状态栏颜色依赖于AppBar设置的backgroundColor进行取色」)、extendBody、extendBodyBehindAppBar、resizeToAvoidBottomInset: false、侧栏 +VerticalDivider、body padding。为一个底栏宽度做这个重构不划算。修法
只给
floatingNavBar那一支包一层Align:RenderPositionedBox.performLayout对子节点用的正是child.layout(constraints.loosen())(rendering/shifted_box.dart:88),与上游MainLayout的做法完全一致;heightFactor: 1→ Align 自身高度按子节点算,Scaffold 据此计算 body 内边距的结果与改动前一致;宽度方向widthFactor为 null 且 maxWidth 有限,Align 撑满整宽,子节点按Alignment.bottomCenter水平居中;hitTestSelf为 false,只测子节点,两侧空白区域的点击会穿透到下面的内容,与上游MainLayout(bottomNav 只占胶囊大小)的表现一致。MD3 底栏与旧版
BottomNavigationBar本来就该撑满,两支未动。五、下一轮注意
win32override 若放开到 ^6.3.0,可以把font_utils.dart的 Windows 分支抄回来。font_utils.dart补_initHarmony(),theme_utils.dart那行Pref.appFont ?? ...无需再改。lib/utils/android/bindings.g.dart每次上游动它都会冲突,固定取--ours。theme_utils.dart是本轮唯一一个「自动合并出编译错误」的文件(重复具名参数),下一轮它仍然是最容易出问题的地方,合并后优先看它。MainLayout(e89241109 opt ui),第五节里列的那几样 Scaffold 依赖必须逐条找到替代,尤其是零高 AppBar 的状态栏取色;跟进之后可以把那层Align去掉。