gpt4 book ai didi

mobile - Flutter - 另一个小部件下方的位置 ListView

转载 作者:IT老高 更新时间:2023-10-28 12:37:12 25 4
gpt4 key购买 nike

我从 Flutter 开始,我遇到了一个在构建时遇到问题的布局,下面是一个视觉示例:

enter image description here

我已经尝试过类似的方法:

        class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Welcome to Flutter',
home: new Scaffold(
appBar: new AppBar(
title: new Text('App'),
),
body: new Column(
children: <Widget>[
new Text('LISTA',
style: new TextStyle(
fontSize: 15.2,
fontWeight: FontWeight.bold,
)
),
new Container(
height: 200.0,
child: new ListView(
children: <Widget>[
new RaisedButton(
onPressed: null,
child: new Text("text button"),
),
new Padding(padding: new EdgeInsets.all(5.00)),
new RaisedButton(
onPressed: null,
child: new Text("text button 2"),
)
],
),
)
]
)
),
);
}
}

但是对于 Container,它需要一个高度,而我需要它来占据屏幕的其余部分。

最佳答案

new Column(
children: <Widget>[
new Text('LISTA', style: new TextStyle(
fontSize: 15.2,
fontWeight: FontWeight.bold,
)),
new Expanded(
child: new Container(
decoration: new BoxDecoration(color: Colors.blue),
child: new ListView(
children: <Widget>[
new RaisedButton(
onPressed: null,
child: new Text("text button"),
),
new Padding(padding: new EdgeInsets.all(5.00)),
new RaisedButton(
onPressed: null,
child: new Text("text button 2"),
)
],
),
)
)
]
)

关于mobile - Flutter - 另一个小部件下方的位置 ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49285054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com