简体   繁体   English

在Flutter中的SliverAppBar和SliverList之间添加空间

[英]Add space between SliverAppBar and SliverList in Flutter

I have a SliverAppBar and below it, a SliverList. 我有一个SliverAppBar,在它下面是一个SliverList。

The first SliverList item is too close to the SliverAppBar. 第一个SliverList项太靠近SliverAppBar。 I'd like to add some spacing between, whether via a bottom margin below the SliverAppBar or above the SliverList. 我想在两者之间添加一些间距,无论是通过SliverAppBar下方还是SliverList上方的底部边距。

How can this be done? 如何才能做到这一点?

SliverPadding - wrap this widget around it. SliverPadding-将此小部件包装起来。

your solution should look something like the this: 您的解决方案应如下所示:

SliverPadding(
  padding: EdgeInsets.only(bottom: 8.0)
  sliver: SliverAppBar(...)
)

OR 要么

SliverPadding(
  padding: EdgeInsets.only(top: 8.0)
  sliver: SliverList(...)
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM