不少時候咱們使用Text是在Row或者Colunms中,這個時候單單是設置overflow沒用的,須要使用Flex和Expanded,如:bash
Flex(
direction: Axis.horizontal,
children: <Widget>[
Text("juejin:"),
Expanded(
child: Text.rich(TextSpan(children: [
TextSpan(
text:
"https://juejin.im/user/594a1ed161ff4b006c10e807/posts",
recognizer: tap,
style: TextStyle(
color: Colors.red,
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold)),
]),textScaleFactor: 0.8,)),
],
)
複製代碼