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 const Offstage();

  //var background = BoxDecoration(color: Theme.of(context).scaffoldBackgroundColor);

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

  // view
  Widget view = Stack(children: [
    _buildMenuItems(widget.model.myMaxWidthOrDefault),
    Center(child: busy)
  ]);

  // scrollable
  view = SingleChildScrollView(controller: controller, child: view);

  // allow mouse drag
  if (widget.model.allowDrag) {
    view = ScrollConfiguration(
      behavior: ProperScrollBehavior().copyWith(
        dragDevices: {
          PointerDeviceKind.touch,
          PointerDeviceKind.mouse,
        },
      ),
      child: view,
    );
  } else {
    view = ScrollConfiguration(behavior: ProperScrollBehavior(), child: view);
  }

  return Container(
      color: widget.model.color ?? Theme.of(context).colorScheme.background,
      child: Center(child: view));
}