【问题标题】:how make scrollable all mobile page in flutter?如何使所有移动页面都可以滚动?
【发布时间】:2020-08-17 08:26:33
【问题描述】:

你知道如何让所有移动页面都可以滚动吗?因为如果我们显示一些小部件,如果它超过移动屏幕的高度就会产生错误

【问题讨论】:

标签: flutter


【解决方案1】:

这会很完美。看看吧。

ListView(
     children: <Widget>[
        // first widget here
        Container(
          height: 200,
          width: MediaQuery.of(context).size.width,
          color: Colors.blue,
        ),
        // third widget here
        Container(
          height: 200,
          width: MediaQuery.of(context).size.width,
          color: Colors.black,
        ),
        // second widget here
        Container(
          height: 200,
          width: MediaQuery.of(context).size.width,
          color: Colors.red,
        ),
      ],
    ),

【讨论】:

    【解决方案2】:

    您可以使用ListView

    Widget view(){
        return ListView(
            children: <Widget[
                 Text("your widgets here"), 
                 SizedBox(height: 20), // you can use these for spacing
            ]
        )
    }
    

    SingleChildScrollView

    Widget view(){
        return SingleChildScrollView(
            children: <Widget[
                 Text("your widgets here"), 
                 SizedBox(height: 20), // you can use these for spacing
            ]
        )
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      • 1970-01-01
      • 1970-01-01
      • 2019-03-05
      • 1970-01-01
      • 1970-01-01
      • 2021-04-07
      相关资源
      最近更新 更多