Add space between SliverAppBar and SliverList in Flutter

Issue

I have a SliverAppBar and below it, a SliverList.

The first SliverList item is too close to the SliverAppBar. I’d like to add some spacing between, whether via a bottom margin below the SliverAppBar or above the SliverList.

How can this be done?

Solution

SliverPadding – wrap this widget around it.

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(...)
)

Answered By – Harsh Bhikadia

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.