【发布时间】:2021-10-21 21:16:55
【问题描述】:
如上图所示,我在顶部(应用栏正下方)有一个红色容器棒。这是我使用的代码
CustomScrollView(
slivers: [
SliverAppBar(),
_buildStack(),
]
),
Widget _buildStack() {
return SliverStack(
children: [
// I have other widgets here ..
SliverPositioned(
bottom: 0, // <-- I have set the bottom to be zero
child: SliverToBoxAdapter(
child: _buildRedBox(),
),
],
)
}
Widget _buildRedBox() {
return Container(
width: double.infinity,
height: 50,
color: Colors.red,
);
}
我正在使用sliver tool package,所以我可以访问SliverStack 和SliverPositioned。
如您所见,我已将底部设置为零。但是红色的框仍然在顶部。我需要在我的 SliverStack 内制作屏幕底部的红色框。该怎么做?
【问题讨论】:
标签: flutter flutter-layout flutter-sliver