Row的text会自动溢出宽度

2022-01-16  本文已影响0人  晓函
image.png

只需要在Text外面加上Expanded就行。
切记层次是Row->Expanded->Text()
中间如果加入其他组件,如GestureDetector,也会失效。

Row(
  children:[
    Text('昵称'),
    Expanded(child:Text('文字内容')),
  ]
)

ps:子回复我最后用TextSpan更加完美的实现了:
https://www.jianshu.com/p/3eef12e324e3

上一篇下一篇

猜你喜欢

热点阅读