如何将两个ListView放在一列中? [英] How to put two ListView in a column?
本文介绍了如何将两个ListView放在一列中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个带有ExpansionTiles的ListView,我想一个接一个地放置在一个列中,该列中首先有其他一些Widget.这是我的代码,
I have two ListView with ExpansionTiles that I would like place one after another inside a column which has some other Widgets first inside it. This is my code,
@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设置为主体,则它们显示得很好.我想念什么吗?
Using this, widget body shows blank.If I set ListView directly as body, they show up fine. Am I missing something ?
推荐答案
尝试将 ListView
包装在 Expanded
中.它没有固有高度,因此您需要给它一个高度.
Try wrapping your ListView
in Expanded
. It doesn't have an intrinsic height so you need to give it one.
这篇关于如何将两个ListView放在一列中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文