builder method

Widget builder(
  1. BuildContext context,
  2. BoxConstraints constraints
)

Implementation

Widget builder(BuildContext context, BoxConstraints constraints) {
  // set focused framework
  System().setActiveFramework(widget.model);

  // set the system constraints
  widget.model.setLayoutConstraints(constraints);

  // stop listening during build
  widget.model.removeListener(this);

  // fire navigator change
  onNavigatorChange();

  // set device orientation
  _setDeviceOrientation(widget.model.orientation);

  // post onstart callback
  if (widget.model.initialized && !started) {
    started = true;
    WidgetsBinding.instance
        .addPostFrameCallback((_) => widget.model.onStart(context));
  }

  // build framework header
  Widget header = _buildHeader(constraints);

  // build framework footer
  Widget footer = _buildFooter(constraints);

  // build framework body
  Widget body = _buildBody(constraints);

  // framework is header, body, footer stacked in a single column inside a fixed frame
  Widget view = Column(children: [header, body, footer]);

  // wrapped drawer view?
  if (widget.model.drawer == null) {
    view = _setGestures(view);
  }

  // check to ensure framework is null before applying SA
  if (widget.model.framework == null) view = SafeArea(child: view);

  // scaffold with safe area
  view = Scaffold(resizeToAvoidBottomInset: true, body: view);

  // start listening to model changes
  widget.model.registerListener(this);

  // assign the current view
  this.view = view;

  return view;
}