我看到了Flutter中用于富文本的代码:
return Row(
children: <Widget>[
?
Container(
child: RichText(
text: TextSpan(
text: "Hello",
style: TextStyle(fontSize: 20.0,color: Colors.black),
children: <TextSpan>[
TextSpan(text:"Bold"),
style: TextStyle( fontSize: 10.0, color: Colors.grey),
),
],
),
),
)
这是打印指令
Hellobold
但我需要将两个文本分开,一个靠左对齐,另一个靠右对齐,就像这样
Hello bold
我该怎么做呢?
谢谢
RichText
不适用于此。对于不同的对齐方式,您必须使用不同的Text
。 - Andrii Turkovskyi