render method
Implementation
@override
Widget render(BuildContext context) {
var reversed = buildReversed();
var axisDirection = widget.vertical
? (reversed ? AxisDirection.up : AxisDirection.down)
: (reversed ? AxisDirection.left : AxisDirection.right);
var scrollable = buildScrollable(axisDirection);
return LayoutBuilder(builder: (outContext, bodyConstraints) {
scrollController.contentWidth =
bodyConstraints.hasBoundedWidth ? bodyConstraints.maxWidth : null;
Widget child;
if (widget.shrinkWrap == true) {
child = scrollable;
} else if (bodyConstraints.hasBoundedHeight) {
child = SizedBox(
height: bodyConstraints.maxHeight,
width:
bodyConstraints.hasBoundedWidth ? bodyConstraints.maxWidth : null,
child: scrollable,
);
} else if (!widget.vertical) {
child = SizedBox(
height: scrollController.firstChildSize?.height ?? 0,
width:
bodyConstraints.hasBoundedWidth ? bodyConstraints.maxWidth : null,
child: scrollable,
);
} else {
child = scrollable;
}
return child;
});
}