【发布时间】:2020-08-03 01:29:24
【问题描述】:
在我的屏幕上,我在顶部和下方有一个透明容器,我有一个带有卡片的 ListView。 现在,当我向下滚动列表时,显然列表顶部的项目会被切断并消失。 有没有办法滚动并让这些项目通过透明容器可见(因此超出了容器的正常限制)?
class MyHomePage extends StatelessWidget {
final List items = ['1', '2', '3', '4', '5', '6', '7', '8','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7','1', '2', '3', '4', '5', '6', '7',];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Column(
children: <Widget>[
Container(
color: Colors.transparent,
height: 200,
child: Center(child: Text('Transparent Box'))),
Expanded(child: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return Card(child: Text(items[index]));
}))
],
));
}
}
我尝试使用堆栈,但 ListView 容器从一开始就通过透明框显示。但我仍然希望“起点”低于该框。我希望你能按照我的想法和解释。 感谢您的帮助,谢谢!
【问题讨论】: