flutter-form-builder-ecosystem / form_builder_file_picker

File picker field widget for FlutterFormBuilder.
https://pub.dev/packages/form_builder_file_picker
BSD 3-Clause "New" or "Revised" License
15 stars 33 forks source link

No validation error is displayed #22

Closed KouloukLeGrand closed 2 years ago

KouloukLeGrand commented 2 years ago

Hi,

When calling _formKey.currentState!.fields["filePicker"]!.invalidate("Validation error"); (assuming _formKey is a GlobalKey<FormBuilderState> and the filePicker field is a FormBuilderFilePicker) or otherwise using the validator: property of FormBuilderFilePicker, no error message appears on the field.

Do I have to tinker my own solution or am I missing something?

K-Zawis commented 2 years ago

Same here.

FormBuilderFilePicker(
    name: 'pdf_file',
    maxFiles: 1,
    type: FileType.custom,
    allowedExtensions: const ['pdf'],
    decoration: const InputDecoration(
        labelText: 'PDF File *',
    ),
    validator: FormBuilderValidators.required(context),
),

Validation fails but border doesn't change nor does the error message show.

I managed to get it working by using the:

decoration: InputDecoration(
    labelText: 'PDF File *',
    errorText: errorText,
),

method.

This may solve the issue for you. However it's not ideal when working with dynamic forms like I am at all...


Any plans fixing this? :confused: