renderProperty method

Iterable<Widget> renderProperty(
  1. BuildContext context,
  2. IMetaFormContext metaForm,
  3. HandledPaths paths,
  4. SunnyFormFieldState<List<IVideoContent?>> state, {
  5. 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<IVideoContent?>> state,
    {Key? key}) {
  final fullPath = paths.fullPath<List<IVideoContent>>();
  final form = context.form();
  final initialValue = form.path(fullPath);
  final readyCheck = state.form?.requestReadyCheck(fullPath);
  return [
    MediaGalleryControl<IVideoContent>(
      name: "$fullPath",
      size: 50,
      columns: 1,
      itemHeight: 200.0,
      initialValue: initialValue,
      progress: readyCheck,
      // readyCheck: readyCheck,
      allowThirdParty: true,
      onChanged: (files) {
        final videoContent = files;
        state.updateValue(videoContent, 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",
        );
      },
    )
  ];
}