buildScrollViewWithWrapper method
Widget
buildScrollViewWithWrapper(
- BuildContext context,
- dynamic scrollables,
- Widget? headerSliver,
- PlatformLayoutInfo layoutInfo, {
- SliverWrapper sliverWrapper = sameWidget,
- bool shrinkWrap = false,
Implementation
Widget buildScrollViewWithWrapper(
BuildContext context,
final dynamic scrollables,
Widget? headerSliver,
PlatformLayoutInfo layoutInfo,
{SliverWrapper sliverWrapper = sameWidget,
bool shrinkWrap = false}) {
var psc = PrimaryScrollController.of(context);
var msc = ModalScrollController.of(context);
var scroller = msc ?? psc;
if (scrollables is CustomScrollView ||
scrollables is NestedScrollView ||
widget.useBody == true) {
_verifyNoHeader(headerSliver);
return scrollables as Widget;
} else if (scrollables is StreamBuilder) {
return scrollables;
} else if (scrollables is Widget) {
if (scroller?.hasClients == true) {
scroller = null;
}
return CustomScrollView(
controller: widget.scroller ?? scroller,
shrinkWrap: shrinkWrap,
physics: scroller == null
? AlwaysScrollableScrollPhysics()
: ModalScrollPhysics(),
slivers: [
if (headerSliver != null) headerSliver,
scrollables,
],
);
} else {
if (scroller?.hasClients == true) {
scroller = null;
}
return CustomScrollView(
controller: widget.scroller ?? scroller,
shrinkWrap: shrinkWrap,
physics: scroller == null
? AlwaysScrollableScrollPhysics()
: ModalScrollPhysics(),
slivers: [
if (headerSliver != null) headerSliver,
if (scrollables is List<Widget>)
for (var sliver in scrollables) sliverWrapper(sliver),
],
);
}
}