【问题标题】:Can't create a scroll in a limited height container in flutter web无法在flutter web的有限高度容器中创建滚动
【发布时间】:2021-03-08 02:45:07
【问题描述】:

我在频道 beta 中使用颤振 1.12.13+hotfix.6。 我想在一个高度有限的容器中创建一个滚动,但它不能按我的意愿工作。 (在手机上很好用) 我的代码:

Container(
  height: 200,
  child: ListView(
    shrinkWrap: true,
    children: <Widget>[
      Container(
        height: 100,
        color: Colors.purple[600],
      ),
      Container(
        height: 100,
        color: Colors.purple[500],
      ),
      Container(
        height: 100,
        color: Colors.purple[400],
      ),
      Container(
        height: 100,
        color: Colors.purple[300],
      ),
    ],
  ),
);

【问题讨论】:

  • 您能否具体说明,什么不起作用。滚动..?小部件本身不是显示器或尺寸限制不适用。?

标签: flutter listview scroll flutter-layout flutter-web


【解决方案1】:

您可以尝试SingleChildScrollView 使小部件可滚动。

【讨论】:

    猜你喜欢
    • 2019-07-04
    • 2021-08-26
    • 2021-12-15
    • 1970-01-01
    • 1970-01-01
    • 2021-08-20
    • 1970-01-01
    • 1970-01-01
    • 2014-03-07
    相关资源
    最近更新 更多