sliverGap method

List<Widget> sliverGap(
  1. double spacing, {
  2. Color? color,
})

Returns a sliver list with SliverGap between each sliver.

Inserts a SliverGap of the specified spacing between each sliver in the list.

The spacing parameter defines the size of the gap between slivers. It must be non-null and positive.

The optional color parameter is useful for debugging to visualize where gaps are placed.

Example:

CustomScrollView(
  slivers: [
    SliverList(...),
    SliverGrid(...),
    SliverToBoxAdapter(...),
  ].sliverGap(16),
)

See also:

  • SliverGap, which creates a fixed-size gap in a sliver context.
  • gap, for adding gaps between regular widgets.

Implementation

List<Widget> sliverGap(double spacing, {Color? color}) => _gapExtBuildWith(
      SliverGap(spacing, color: color),
    );