sliver_center 1.1.1
sliver_center: ^1.1.1 copied to clipboard
A sliver that centers its child sliver within itself, primarily designed for centering slivers wrapped in SliverConstrainedCrossAxis.
SliverCenter #
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 #
Usage #
Wrap your sliver child with SliverCenter to center it. SliverCenter works within the context of a CustomScrollView and its sliver layout system.
Code #
SliverCenter(
sliver: SliverList( // Or any other sliver
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
height: 50,
color: Colors.blue,
);
},
childCount: 10,
),
),
)