如何更改文本部分的颜色?我正在尝试使文本显示为“ Don't have an account? Register now!
”,但我想为Register now!
零件添加颜色。如果可能的话我该怎么办?
使用RichText
https://docs.flutter.io/flutter/widgets/RichText-class.html
RichText(
text: TextSpan(
text: "Don't have an account? ",
style: TextStyle(color: Colors.black, fontSize: 40),
children: <TextSpan>[
TextSpan(text: ' Register now!', style: TextStyle(color: Colors.red)),
],
),
);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句