class _DemoPageState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
return Center(
child: RichText(
text:TextSpan(
text: 'i',
style: TextStyle(color: Colors.red,fontSize: 30.0),
children: <TextSpan>[
TextSpan(text:'want',style: TextStyle(fontWeight: FontWeight.bold,color: Colors.red)),
TextSpan(text:'study',style: TextStyle(color: Colors.blue))
]
)
)
);
}
}
Flutter笔记59:RichText富文本组件
RichText富文本组件,当文字段落样式比较复杂时,可以用RichText拆分,进行修饰:
