我在一个专栏里有两个扩展的小部件。第一个扩展小部件包含一个包含可变长度文本的RichText小部件。如果文本溢出,则将其截断。我想要实现的是,如果内容太大,整个RichText小部件就会缩小。我尝试过FittedBox,它通常适用于文本小部件,但当我将其应用于RichText小部件时,它会缩小,但包装会被移除。如何包装,然后,如果richtext小部件太大,无法展开然后缩小?
return Container(
child: Column(children: [
Expanded(
flex: 1,
// child:FittedBox(fit: BoxFit.scaleDown,
child: RichText(
text: TextSpan(
text:
"I am a TextSpan widget and am veyr very long lskjdf lskdj flksj dflksjd lfkj",
style:
DefaultTextStyle.of(context).style.copyWith(fontSize: 35)),
)),
Expanded(flex: 4, child: Text("blah blah"))
]));