Skip to content

FormBuilderImagePicker should also accept Image classes as initialValues #414

Closed
@codezork

Description

@codezork

For all that initially have the images coming from a database or other source, the code only accepts String or File types if not running as a web application. I would suggest to also accept Image objects as fallback in case s.o. prepares them.
The suggested change would be from line 168 and the Container would look like this:

                      Container(
                        width: widget.imageWidth,
                        height: widget.imageHeight,
                        margin: widget.imageMargin,
                        child: kIsWeb
                            ? Image.memory(item, fit: BoxFit.cover)
                            : item is String
                                ? Image.network(item, fit: BoxFit.cover)
                                : item is File
                                    ? Image.file(item, fit: BoxFit.cover)
                                    : item,
                      ),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @codezork

        Issue actions

          FormBuilderImagePicker should also accept Image classes as initialValues · Issue #414 · flutter-form-builder-ecosystem/flutter_form_builder