2017-06-23 71 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

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

相關問題