builder method
Implementation
Widget builder(BuildContext context, BoxConstraints constraints) {
// Check if widget is visible before wasting resources on building it
if (!widget.model.visible) return const Offstage();
// build the body
var contents = BoxView(widget.model.getContentModel());
// build the scroll bar
Widget view = _buildScrollbar(contents);
// apply constraints
view = applyConstraints(view, widget.model.constraints);
// add margins around the entire widget
view = addMargins(view);
// expand in both axis
if (widget.model.expand) {
view = SizedBox(
width: constraints.maxWidth,
height: constraints.maxHeight,
child: view);
}
// contract in cross axis
else {
view = widget.model.layoutType == LayoutType.row
? Column(mainAxisSize: MainAxisSize.min, children: [view])
: Row(mainAxisSize: MainAxisSize.min, children: [view]);
}
return view;
}