固定大小可伸缩容器中的长文本

时间:2020-02-17 08:52:45

标签: flutter containers scrollable longtext

你好,世界希望你一切都好 希望有一个固定大小的容器,其中有一个Text()表示长文本大于容器的大小 谢谢您的帮助

扑朔迷离

1 个答案:

答案 0 :(得分:0)

借助Stonik找到了解决方案

尝试添加scrollDirection(水平)

SingleChildScrollView(
scrollDirection: Axis.horizontal,
  child: Container(
      height: 200,
      child: Text(
          "Long text here which is longer than the container height"))),

默认为垂直

或者如果您想拥有自己的身高,则必须更改顺序(容器内的SingleChildScrollView)

Container(
    height: 200,
    child: SingleChildScrollView(
        child: Text(
            "Long text here which is longer than the container height"))),
相关问题