-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #683 (bangumi cards text overflow) #686
Conversation
ClipRect 的性能开销很高,而且边缘过渡不平滑 啊,突然后悔了,我在思考这样做的必要 我们可以使用限制行数的做法,例如在 BangumiCard 上限制行数为2 移除历史记录卡片上的番剧标签等 |
滚动列表中嵌套滚动列表从来不是好主意 |
又或者用 |
这应该是更好的解决方法,在可能溢出的地方使用。 |
已经把 |
我们进行其他更改的目的是什么。我们似乎移除了一些会让视觉效果变得更好点占位符。 |
啊,应该是试图修复 |
a1. Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(...),
...
],
), 可以用更少的实现原版的视觉效果 Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(child: Text(...)),
]
),
...
],
),
因为之前试图用 不过话说回来(参考 a1),根据我的观察( Padding(
padding: Padding.fromLTRB(3, 4, 3, 0),
child: Column(
children: [
Text(...),
SizedBox(height: 1)
],
),
), 以外,有没有考虑直接去除 Padding(
padding: Padding.fromLTRB(3, 4, 3, 1),
Text(...),
), PS: |
相当不错的修改,我们确实应该那么做 |
好的已经修改完毕,没问题的话 #683 应该暂时解决了。 PS: 额,bangumi_card 忘了 alignment 。 |
字体缩放本来就不是我们应该考虑的事情 字体缩放导致的溢出完全是预期内的 不过我觉得很奇怪,如果默认倍率是 1 的话,字体也太大了,正常情况下 1 不会溢出 直觉上这里可能有更复杂的问题,涉及 flutter 的物理像素和逻辑像素。头痛 |
嗯,确实。
结果还是屏幕分辨率间接造成的吧 |
不过这会不会和 |
我不清楚,可能和DPI缩放更相关。 |
卡片高度可以用 |
|
|
或者考虑 |
嗯,如果搞定不了卡片高度的话可以试试,再不然就:
|
刚刚试了,似乎不可行。不过参考了 Android 平台: PS: final tt = Theme.of(context).textTheme;
final tsFontSize = tt.titleMedium?.fontSize ?? kDefaultFontSize;
final lmFontSize = tt.labelMedium?.fontSize ?? kDefaultFontSize; 桌面平台: |
Wrap 在手机上和电脑上的垂直方向上的间距行为是不一致的,手机上的 runSpacing 需要给 0 |
嗯,大概调整至 |
- reverted from using Wrap to Column for predictability - implemented `Utils.getTextPxHeight`
参考了 https://api.flutter.dev/flutter/painting/TextStyle/height.html ,算是解决了溢出的问题,不过是使用回之前的 |
额,我觉得上面的实现很 hack 。我不知道 @ErBWs 对此怎么看 我更喜欢 Chip 的方案,以及需要使用 colorscheme 中预调好的颜色,而不是自己自定义,自定义的颜色看上去非常不协调 |
以及 既然已经用下划线作为变量名的开头来表示这是一个私有而非公有的对象,为什么不直接放到类的内部呢 |
老实说我也比较喜欢 至于颜色的话,暂时不确定要用
一开始是担心代码会太长太复杂,不过现在看来确实没什么必要,可以直接放进内部。
你是指五颜六色那个还是黑色那个显得很大? |
五颜六色那个 |
(其实这两种 |
- simplified history page `mainAxisExtent` height formula - merged `_PropertyText`, `_PropertyChip` into `BangumiHistoryCardV.propertyChip`
这里 Surface 的观感有些奇怪 参考 https://m3.material.io/styles/color/choosing-a-scheme 其实可以考虑用 SecondaryContainer 之类的颜色,具体可以再看看,亮色模式下也不能太糟糕 除此之外的两个问题
|
啊,差点忘了
毕竟有些参数的类型是 int, DateTime 等类型, 感觉直接在内部转换成 String 会比较方便 |
传入 String ,在外部完成转换 |
大致上已经修改完毕,如果没问题的话应该可以了 |
感谢你的工作。我会在CI通过后合并。 |
* Clip overflow sections for bangumi cards * TextScale to prevent overflow instead * Added back & simplified bangumi cards' padding * Added text alignment to bangumi card * Replaced `RichText` with `Text` for simplicity and readability * Made BangumiHistoryCardV height scale by resolution * Removed unused lines * Use wrap chips instead of column texts to conserve space - revert `mainAxisExtent` to fixed value to prevent overflow on low res * Fixed wrap chips run spacing issue on mobile * Calculate `mainAxisExtent` with font style - reverted from using Wrap to Column for predictability - implemented `Utils.getTextPxHeight` * Changes again in favor of Wrap-Chip design - simplified history page `mainAxisExtent` height formula - merged `_PropertyText`, `_PropertyChip` into `BangumiHistoryCardV.propertyChip` * Updated UI colors and parameter type handling, removed unused functions (cherry picked from commit 7e56c9b)
这是一个有必要但非常非常小的变更,我会直接提交它 |
bug |
好像是颜色改深了,点击卡片时颜色有改变吗? |
这个问题不是这个PR引入的,1.5.5 也有问题,需要调查一下 |
问题可能来自 MenuAnchor 控件 |
简单修了一下,总觉得这是 flutter 的 bug |
#683 裁剪掉溢出的部分