sliverScrollView function
Widget
sliverScrollView({
- required List<
Widget> children, - ScrollController? controller,
- Key? key,
Creates a CustomScrollView from a list of widgets, automatically converting non-sliver widgets into SliverToBoxAdapter.
children is the list of widgets to display.
controller optionally controls scrolling.
key optionally assigns a key to the scroll view.
Implementation
Widget sliverScrollView({
required List<Widget> children,
ScrollController? controller,
Key? key,
}) {
return CustomScrollView(
controller: controller,
key: key,
slivers:
children
.map(
(s) =>
s is SliverList || s is SliverGrid || s is SliverPadding
? s
: s.sliver(), // Wrap non-slivers into SliverToBoxAdapter
)
.toList(),
);
}