buildElement method

Widget buildElement(
  1. BuildContext context,
  2. Map<String, dynamic> element
)

Implementation

Widget buildElement(BuildContext context, Map<String, dynamic> element) {
  switch (element["type"]) {
    case ElementTypes.horizontalLayout:
      return buildLayout(context, element);

    case ElementTypes.verticalLayout:
      return buildLayout(context, element);

    case ElementTypes.control:
      String scope = element["scope"] ?? "";
      Control? control = Control.from(
        schema: schemaGet(scope),
        options: getOptions(element),
        scope: scope,
        isRequired: isRequired(scope),
        defaultValue: getDefaultValue(scope),
        onValueChanged: getValueChanged(scope),
      );

      if (control == null) {
        return Container();
      }

      widget._controls.add(control);
      return control;

    default:
      return Container();
  }
}