MetaFormControl<M>.ofMSchema constructor

MetaFormControl<M>.ofMSchema(
  1. BuildContext context, {
  2. Key? widgetKey,
  3. required JsonPath fieldPath,
  4. required MSchemaForm<MBaseModel> form,
  5. Map<String, dynamic>? scope,
  6. MetadataOverrides? overrides,
  7. required SunnyFormFieldState<M> fieldState,
  8. List<MetaPropertyHandler>? extraHandlers,
  9. String? label,
  10. bool checkAll = true,
  11. String? placeholder,
  12. JsonPath? basePath,
})

Implementation

factory MetaFormControl.ofMSchema(
  BuildContext context, {
  Key? widgetKey,
  required JsonPath fieldPath,
  required MSchemaForm form,
  Map<String, dynamic>? scope,
  MetadataOverrides? overrides,
  required SunnyFormFieldState<M> fieldState,
  List<MetaPropertyHandler>? extraHandlers,
  String? label,
  bool checkAll = true,
  String? placeholder,
  JsonPath? basePath,
}) {
  final metaProp = form.definition!.prop(fieldPath);
  return MetaFormControl._(
    widgetKey: widgetKey,
    fieldPath: fieldPath,
    checkAll: checkAll,
    fieldState: fieldState,
    metaFormField: MetaFormFieldContext(
        formConfig: overrides?.formConfig?.orEmpty()[fieldPath] ?? [],
        form: MetaFormContext.ofModelForm(
          context,
          controller: form,
          embedPath: basePath,
          scope: scope,
          overrides: overrides,
          extraHandlers: extraHandlers,
          definition: form.definition!,
        ),
        property: metaProp!,
        fullPath: (basePath! + fieldPath)),
    basePath: basePath.self,
    label: label,
    placeholder: placeholder,
  );
}