2017-06-23 78 views
0

我有两个ListView和ExpansionTiles,我希望将其放置在一个列中,该列中首先有一些其他的Widgets。 这是我的代码,如何将两个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()) 


    ] 
     , 
    ) 
     , 
    ) 
); 

}

利用这一点,小部件体显示blank.If我直接设置的ListView为体,它们显示了罚款。我错过了什么吗?

回答

2

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

+0

我如何将整个身体包裹在滚动视图中? –

+0

你可能应该问一个单独的问题;这取决于你有多少内容。如果它很多,请考虑一个CustomScrollView,如果它不是很多,SingleChildScrollView并将ListView更改为Column。使用CustomScrollView或SingleChildScrollView的 –

+0

为子窗口小部件提供了带有大文本的黑色背景。 –

相关问题