我的文本小部件看起来像 Text("Last Active: some location area..")
.
我可以使用样式更改完整文本的文本样式。但我只是想将 Last active 更改为粗体。 Text("<b>Last Active</b> some location area name..")
如果我为单独的文本使用 Row,它会起作用,但会出现间距问题。
最好的解决方案是什么。加粗是唯一的要求。
谢谢
最佳答案
RichText 是解决方案
RichText(text: TextSpan(children: [
TextSpan(text: 'Last Active', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: ' some location area name..')
]))
关于flutter - 在 flutter 中格式化文本小部件的部分文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52833887/