buildSlivers method
Build the list of widgets to place inside the viewport.
Subclasses should override this method to build the slivers for the inside of the viewport.
To learn more about slivers, see CustomScrollView.slivers.
Implementation
@override
List<Widget> buildSlivers(BuildContext context) {
Widget child;
switch (status) {
case PagingStatus.ongoing:
child = loadingListingBuilder(context);
break;
case PagingStatus.completed:
child = completedListingBuilder(context);
break;
default:
child = errorListingBuilder(context);
}
if (scrollDirection == Axis.horizontal) {
return [
SliverToBoxAdapter(
child: Container(
padding: padding,
),
),
(builderDelegate.animateTransitions)
? SliverAnimatedSwitcher(
duration: builderDelegate.transitionDuration,
child: child,
)
: child,
];
}
return [
reverse
? const SliverToBoxAdapter(
child: SizedBox(),
)
: refreshBuilder(context),
SliverToBoxAdapter(
child: Container(
padding: padding,
),
),
(builderDelegate.animateTransitions)
? SliverAnimatedSwitcher(
duration: builderDelegate.transitionDuration,
child: child,
)
: child,
];
}