Skip to content
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

add rich text parser, make comments and logs selectable #412

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

ErBWs
Copy link
Contributor

@ErBWs ErBWs commented Nov 21, 2024

两个已知问题

  1. fontSize 好像不生效
  2. 滑动有的时候会跳跃一下,我没找到解决办法
image

@Predidit
Copy link
Owner

这个工作太棒了。

虽然理论上应该有解析为 AST 这种更优雅的方式处理 BBCode 但现在的实现已经足够好。

不过看上去有一个可以优化的地方。

我们应该避免使用 Image.network 渲染网络图片,这会在图片被卸载时(例如划出屏幕),其缓存被完全移除,并在其重新进入屏幕时重新加载。

这可能是导致滑动跳跃的原因,因为有图片的高度在随着其加载与卸载发生变化。

我们可以参考头像的方案,使用 cached_network_image 库来处理网络图片。

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 21, 2024

有一定的改善但不多,我猜测可能和 ListView 嵌套有关

Screen-2024-11-21-204417.mp4

@Predidit
Copy link
Owner

我尝试了一些方法也没能解决,我们先合并这个PR,看上去这个问题需要搁置一下

@Predidit Predidit merged commit 6ca93b5 into Predidit:main Nov 21, 2024
5 checks passed
@Predidit
Copy link
Owner

这个问题的本质还是图片加载问题

我们没有办法知道图片尺寸,一个可能的解决方法就是使用已有的抽象 /lib/bean/network_image_layer

这会为图片设置占位符,代价是我们需要预先设定图片尺寸

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 21, 2024

我想我找到解决办法了。

我观察到在往上滚动时页面在尝试跳跃到上一个栏目的顶部,导致组件很大时出现快速跳跃

使用 SingleChildScrollView 包裹 ListView,并设置 shrinkWrap 为 true 可以将滚动交由 SingleChildScrollView 控制而避免滚动跳跃问题

我会提交一个 PR 解决这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants