我想改变文字中字母的颜色。我想将字母H的颜色从文字Hello更改为橙色,并让ello随着时间的推移而变化。那么如何改变它。
发布于 2022-02-27 08:57:59
如果它是静态的,可以使用RichText
示例
RichText(
text: TextSpan(
text: 'H',
style: TextStyle(color:Colors.orange),
children: const <TextSpan>[
TextSpan(text: 'ello', style: TextStyle()),
],
),
)如果它是动态的,您可能需要使用插件(如文本 )。
SimpleRichText(r'*_/this is all three*_/ (*{color:red}bold*, _{color:green}underlined_, and /{color:brown}italicized/). _{push:home;color:blue}clickable hyperlink to home screen_')发布于 2022-02-27 08:53:03
Row(
children: [
Text(
'H',
style: TextStyle(color: Colors.orange),
),
Text('ello')
],
),发布于 2022-02-27 09:41:47
Row(
children: [
Text(
'H',
style: TextStyle(color: Colors.orange),
),
Text('ELLO',style: TextStyle(color: Colors.black),],
),https://stackoverflow.com/questions/71283346
复制相似问题