【发布时间】:2019-03-24 03:25:15
【问题描述】:
我尝试了几种不同的方法,但我无法让它发挥作用。我想要实现的布局非常简单,在原生 Android 中实现起来轻而易举:
- 顶部固定容器(蓝色)
- 下方的可滚动容器(红色)。 ListView 在我的情况下不起作用。
我尝试使用SingleChildScrollView,但它似乎在Column 中不起作用。也许我做错了什么或者我没有使用正确的小部件......
我的结果:
Scaffold(
body: Column(
children: <Widget>[
Container(
height: 100.0,
color: Colors.blue,
),
SingleChildScrollView(
child: Container(
color: Colors.red,
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
Text('Red container should be scrollable'),
Container(
width: double.infinity,
height: 700.0,
padding: EdgeInsets.all(10.0),
color: Colors.white.withOpacity(0.7),
child: Text('I will have a column here'),
)
],
),
),
),
],
),
)
【问题讨论】:
标签: flutter listview dart flutter-layout