createWidget method

  1. @protected
Widget createWidget(
  1. BuildContext context,
  2. WidgetNodeSpec spec,
  3. Map state,
  4. Map? parentContext,
)

Creates a Widget based on its spec.

Implementation

@protected
Widget createWidget(BuildContext context, WidgetNodeSpec spec, Map state,
    Map? parentContext) {
  if (!EditorBloc.editMode && spec.props["buildCondition"] != null) {
    if (!properties.build(
        Types.kCondition.type, spec.props["buildCondition"])) {
      return const NoWidget();
    }
  }

  if (!_widgetBuilders.containsKey(spec.type)) {
    log.severe("Widget builder for type '${spec.type}' not found");
    return const SizedBox();
  }

  final params = BuildParameters(context, spec, state, parentContext);
  return _widgetBuilders[spec.type]!(params);
}