builder method

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

Implementation

Widget builder(BuildContext context, BoxConstraints constraints)
{
  // Check if widget is visible before wasting resources on building it
  if (((widget.model.children?.isEmpty ?? true) && widget.child == null)) return Offstage();

  if (widget.model.animations != null && widget.model.animations!.isNotEmpty && widget.child != null)
  {
    Widget view = _buildTransitionChildren();

    // Start the Controller

    return view;
  }

  // Build Children
  widget.children.clear();
  if (widget.child != null) widget.children.add(widget.child!);
  if (widget.model.children != null)
    widget.model.children!.forEach((model) {
      if (model is IViewableWidget) {
        var view = (model as IViewableWidget).getView();
        widget.children.add(view);
    }});
  if (widget.children.isEmpty) widget.children.add(Container());
  var child = widget.children.length == 1
      ? widget.children[0]
      : Column(
          children: widget.children,
          crossAxisAlignment: CrossAxisAlignment.start);

  // Build View
  Widget? view;

  // Start the Controller
  if ((widget.model.autoplay == true) && (!_stopped)) start();

  // Return View
  return view ?? child;
}