buildSlivers method
Builds the slivers for the scroll view.
Implementation
List<Widget> buildSlivers(BuildContext context) {
return [
if (sliverBefore != null) ...sliverBefore!.map((x) => x(context)),
// Non-sticky header
if (headerBuilder != null && headerSticky != true)
SliverToBoxAdapter(
child: Container(key: const ValueKey('list_header'), child: headerBuilder!(context)),
),
// Main content with padding
SliverPadding(
padding: padding ?? EdgeInsets.zero,
sliver: SliverMainAxisGroup(
slivers: [
if (beforeItemsBuilder != null)
SliverToBoxAdapter(
child: Container(
key: const ValueKey('list_before_items'),
child: beforeItemsBuilder!(context),
),
),
buildContentSliver(context),
],
),
),
// Infinite scroll indicator
if (infiniteScroll && infiniteScrollFooterBuilder != null)
SliverToBoxAdapter(
child: Container(key: const ValueKey('list_infinite_scroll_footer'), child: infiniteScrollFooterBuilder!(context)),
),
// Non-sticky footer
if (footerBuilder != null && footerSticky != true)
SliverToBoxAdapter(
child: Container(key: const ValueKey('list_footer'), child: footerBuilder!(context)),
),
if (sliverAfter != null) ...sliverAfter!.map((x) => x(context)),
];
}