flutter - 如何将两个 ListView 放在一个列中?

我有两个带有 ExpansionTiles 的 ListView,我想将它们一个接一个地放在一个列中,该列中首先包含一些其他小部件。 这是我的代码,

 @override
 Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
    appBar: new AppBar(
        title: new Text("Project Details"),
        backgroundColor: Colors.blue[800]),
    body:

    new Padding(padding: new EdgeInsets.all(10.0),
      child: new Column(children: <Widget>[
        new Text(project.name, style: new TextStyle(
            fontWeight: FontWeight.bold,
            color: Colors.blue[700],
            fontSize: 15.0
        )),
        new RowMaker("District", project.district),
        new RowMaker("River", project.river),
        new RowMaker("Tac Approved", project.tacApproved),
        new RowMaker("Func Sanctioned", project.fundSanctioned),
        new Row(children: <Widget>[
          new FlatButton(onPressed: null,
            color: Colors.blue,
            child: new Text("Gallery"),
            textColor: Colors.white,),
          new FlatButton(onPressed: null,
              color: Colors.blue,
              child: new Text("Upload Images"),
              textColor: Colors.white),
          new FlatButton(
              onPressed: null,
              color: Colors.blue,
              child: new Text("Update"),
              textColor: Colors.white),
        ],),
        new ListView(children: getSfListTiles()),
        new ListView(children: getWorkStatementTiles())


    ]
        ,
      )
      ,
    )
);

}

使用这个,小部件主体显示空白。如果我将 ListView 直接设置为主体,它们显示得很好。我错过了什么吗?

最佳答案

尝试将您的 ListView 包装在 Expanded 中。它没有固有的高度,所以你需要给它一个。

https://stackoverflow.com/questions/44715865/

相关文章:

flutter - 如何在 Flutter 中将图像和文件上传到服务器?

flutter - TextFormField 和 TextField 有什么区别?

generics - 为什么有状态的小部件在flutter中定义为两个类?

dart - Flutter - 更改 OutlineInputBorder 的边框颜色

asynchronous - 异步对调用者滚雪球,不能使构造函数异步

dart - Flutter 中的 Openstreetmap?

flutter - Flutter 中 SliverList 与 ListView 的区别

flutter - 变量名前的下划线 "_"对 Flutter 意味着什么

flutter - Flutter 框架中使用的键是什么?

json - 类型 'List' 不是类型 'List' 的子类型,其中