我正在尝试使用RotatedBox创建竖排文本。这个小工具运行良好,文本也会相应地旋转,但是当文本太长时,它会自动向右扩展,这不是我想要的行为。
RotatedBox(
quarterTurns: -1,
child: Tooltip(
message: "the long text message when user wants to see it",
child: Container(
width: 50,
child: Text("some long text that is too long to fit",
overflow: TextOverflow.fade,
),
)),
),
如上图所示,文本不是使用overflow裁剪的,而是向右扩展,造成了尴尬的间隙。我已经尝试向RotatedBox添加更多的容器,不幸的是它根本没有限制它的大小。
发布于 2021-10-14 22:43:19
我通过在RotatedBox外部的容器上添加高度和宽度修复了这个问题
Container(
height: 50,
width: 20,
child: RotatedBox(
quarterTurns: -1,
child: Tooltip(
message: "the long text message when user wants to see it",
child: Text("some long text that is too long to fit",
overflow: TextOverflow.fade,
)),
),
),
https://stackoverflow.com/questions/69580161
复制相似问题