gpt4 book ai didi

flutter - 在 flutter 中格式化文本小部件的部分文本

转载 作者:IT王子 更新时间:2023-10-29 06:51:32 26 4
gpt4 key购买 nike

我的文本小部件看起来像 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com