不少时候咱们使用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,)),
],
)
复制代码