build method

  1. @override
Widget build(
  1. BuildContext context
)

Implementation

@override
Widget build(BuildContext context)
{
  // Check if widget is visible before wasting resources on building it
  if (!widget.model.visible) return Offstage();

  // Center
  Widget view = BoxView(widget.model);

  // Close Keyboard
  //final gesture = GestureDetector(onTap: () => WidgetModel.unfocus(), child: view);

  /// Busy / Loading Indicator
  busy ??= BusyView(BusyModel(widget.model, visible: widget.model.busy, observable: widget.model.busyObservable));

  // stack gets the same size as the view when busy is positioned rather than center
  view = WillPopScope(onWillPop: quit, child: Stack(children: [view, Positioned(child: busy!, left: 0, right: 0, top:0, bottom: 0)]));

  // apply user defined constraints
  return view;
}