Skip to content
pubscout

sliver_center

1.1.2, released 2 years ago by inflalite.com

A Flutter sliver that centers its child sliver within itself along the cross axis.

WASM-ready
$ flutter pub add sliver_center
Source repository

What it does

SliverCenter is a custom sliver widget designed to center a child sliver, such as a SliverList or SliverGrid, within the available space along the cross axis. It works within CustomScrollView and its sliver layout system to keep the child positioned in the center regardless of the parent's size.

AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to center a sliver like a SliverList or SliverGrid within its parent along the cross axis
  • You are building responsive layouts with CustomScrollView where slivers need to be centered on big screens

Skip it when

  • You are working with standard box widgets instead of slivers
  • You do not need cross-axis centering for your sliver content

Strengths

  • 100% test coverage ensuring reliability
  • Simple declarative syntax for centering slivers

Weaknesses

  • Limited scope restricted strictly to sliver-based layouts

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

none

SliverCenter(
  sliver: SliverList(
    delegate: SliverChildBuilderDelegate(
      (BuildContext context, int index) {
        return Container(
          height: 50,
          color: Colors.blue,
        );
      },
      childCount: 10,
    ),
  ),
)

Alternatives

Packages that do the same job and could replace sliver_center.