A Journal Through My Activities, Thoughts, and Notes
#flutter #markdown
行内代码inline code不能选中复制的问题终于解决了,要怪自己当初抄作业的时候没有抄全。几个要点:
1. 行内code也要包在一个Container
2. 行内code的样式不能有backgroundColor
3. 行内code的样式不可以直接用 style: preferredStyle

鸣谢Master Markdown and Multi-line Selection in Flutter: A Step-by-Step Tutorial Flutter markdown: Using Markdown with Cross-Line Selection in Flutter
#flutter
如果只有 AppBar 需要根据状态变化更新,那么你可以只在 AppBar 上使用 Consumer。这样做的好处是,仅当状态变化时,AppBar 会重新构建,而不会影响其他部分的 UI,从而提升性能。
#flutter #initState #tips
The error you're encountering is caused by trying to update the UI (noteModel.content = '#${noteModel.initialTag}\n';) within the initState method, which triggers a rebuild of the widget while it is still in the build phase. This is not allowed in Flutter, as it can lead to inconsistent states.

To resolve this issue, you should delay the update until after the build phase. You can achieve this by using WidgetsBinding.instance.addPostFrameCallback, which schedules the code to run after the current frame has been rendered.
 
 
Back to Top