반응형
[flutter]
Fixing errors when you insert ListView with other widgets in the column
(Column에 다른 위젯과 함께 ListView를 넣을때 오류 해결)
예를 들어,
아래와 같은 코드에서는 Column 안에 여러 위젯과 함께 ListView가 구현되어있다.
(For example,
In the code below, ListView is implemented with several widgets in the column.)
@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를 Expanded로 감싸서 선언하면 된다.
(This will result in an error on the page.
To solve this problem, you can declare the ListView wrapped in Expanded.)
반응형