ove*_*ing 6 flutter flutter-layout
如何更改部分文本的颜色?我正在努力使文字显示“ Don't have an account? Register now!”,但我想为Register now!零件添加颜色。如果可能,我该怎么做?

Doc*_*Doc 15
使用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)),
],
),
);
Run Code Online (Sandbox Code Playgroud)