可在一行文字里定义多种样式
class BasicDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RichText(
text: TextSpan(
text: 'ninghao',
style: TextStyle(
color: Colors.deepPurpleAccent,
fontSize: 34,
fontStyle: FontStyle.italic, // 斜体
fontWeight: FontWeight.w100, // 文字的粗细
),
children: [
TextSpan(
text: '.net',
style: TextStyle(
fontSize: 17,
color: Colors.black
)
)
]
),
);
}
}