renderProperty method
Iterable<Widget>
renderProperty(
- BuildContext context,
- IMetaFormContext metaForm,
- HandledPaths paths,
- SunnyFormFieldState<
MKey?> state, { - Key? key,
override
Renders a widget (or null) for a provided HandledPaths (see acceptProperties)
Implementation
@override
Iterable<Widget> renderProperty(
BuildContext context, IMetaFormContext metaForm, HandledPaths paths, SunnyFormFieldState<MKey?> state,
{Key? key}) {
final prop = paths.property as IRefProperty;
final theRef = prop.theRef;
final _mfProp = metaForm.prop(paths.property!);
KeyedOptionsHandler<MKey?, T?> handler = context.optionsService.getKeyedHandler(theRef, metaContext: _mfProp);
final viewHandler = context.typeaheadService.getTypeaheadRenderer<MKey, T>(theRef);
final fullPath = paths.fullPath<MKey>();
return [
OptionSelectorControl<MKey?, T?>(
key: Key("field-$fullPath"),
handler: handler,
focusNode: state.focusNode,
isRequired: prop.isRequired == true,
// noOptionsLabel: widget.noOptionsLabel,
// autofocus: widget.autofocus ?? false,
onChange: (value, source) {
state.updateValue(value?.key, source);
},
expected: (option) => option?.key,
onError: (error) => state.error = error,
initialKeyValue: state.value,
viewHandler: viewHandler,
)
];
}