Skip to content

demian-ilnytskyi/flutter_sliver_center

Repository files navigation

SliverCenter

pub pub tests Code Analysis & Formatting

A Flutter widget that centers its sliver child within the available space along the cross axis. This is particularly useful when you want to ensure a sliver, such as a SliverList or SliverGrid, is positioned in the center of its parent, regardless of the parent's size.

Preview

gif_preview

big_screen_preview

small_screen_preview

Usage

Wrap your sliver child with SliverCenter to center it. SliverCenter works within the context of a CustomScrollView and its sliver layout system.

Test Coverage and Flutter Version Support

This package has 100% test coverage, ensuring reliability and robustness. The tests have been executed on Flutter versions 3.16.0 and 3.29.0, confirming full support for these versions and all versions in between.

Code

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors