Flutter文本小部件中不同字母的不同颜色

10
我有一个使用案例,我想在
2个回答

17

3
RichText(
  text: TextSpan(
    text: 'Hello ',
    style: DefaultTextStyle.of(context).style,
    children: const <TextSpan>[
      TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
      TextSpan(text: ' world!'),
    ],
  ),
)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接