renderProperty method
Iterable<Widget>
renderProperty(
- BuildContext context,
- IMetaFormContext metaForm,
- HandledPaths paths,
- SunnyFormFieldState<
List< state, {IImageContent?> > - Key? key,
override
Renders a widget (or null) for a provided HandledPaths (see acceptProperties)
Implementation
Iterable<Widget> renderProperty(
BuildContext context,
IMetaFormContext metaForm,
HandledPaths paths,
SunnyFormFieldState<List<IImageContent?>> state,
{Key? key}) {
final fullPath = paths.fullPath<List<IImageContent>>();
final form = context.form();
final initialValue = form.path(fullPath);
final readyCheck = state.form?.requestReadyCheck(fullPath);
return [
MediaGalleryControl<IImageContent>(
size: 50,
name: "$fullPath",
initialValue: initialValue,
progress: readyCheck,
// readyCheck: readyCheck,
allowThirdParty: true,
onChanged: (files) {
final imageContent = files;
log.info(
"Updating image lists: ${imageContent.map((e) => e.imageUrl).join()}");
state.updateValue(imageContent, AttributeSource.control);
},
onError: (response, stack) {
SunnyHud.error(context, "Problem uploading", duration: twoSeconds);
log.warning("Error uploading: $response", response, stack);
state.error = ValidationError.ofString(
fullPath,
"Problem uploading",
debugMessage: "$response",
);
},
)
];
}