可以使用SingleChildScrollView包装Container,如下所示:

SingleChildScrollView(
  scrollDirection: Axis.horizontal,
  child: Container(
    width: 1000, // 设置Container的宽度
    child: Row(
      children: <Widget>[
        // 超出Container宽的内容
      ],
    ),
  ),
)

其中,scrollDirection属性设置为Axis.horizontal表示水平滚动,child属性设置为一个Row控件,内部包含需要滚动的内容。需要注意的是,Container需要设置宽度,否则无法触发滚动。

flutter让超出Container宽的内容滚动起来

原文地址: https://www.cveoy.top/t/topic/bUE7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录