Giter Club home page Giter Club logo

form_builder_file_picker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

form_builder_file_picker's Issues

Add onTap callback on file preview list

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

4.1.0

What you'd like to happen

Provide an onTap callback in the File Previewer widget. It will be useful in case of viewing file after uploading.

Usecase:
lets assume a user upload multiple files (pdf). As its not possible to preview pdf file we can provide a callback where we get a Platform file as argument. And using callback we can open file using external package.

Alternatives you've considered

No response

Aditional information

image

when a file is picked, onChange is called twice.

when a file is picked, onChange is called twice.

Code:

class TestFormPicker extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: FormBuilderFilePicker(
          onChanged: (val) async {
            print('CALL the File Upload');
          },
          name: 'file',
        ),
      ),
    );
  }
}

Add Web support

It would be nice if FormBuilderFilePicker package would support web platform as well.

General: Creating Multiple Duplicate Fields

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

4.0.0

Platforms

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

Flutter doctor

Flutter doctor
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4 22F66 darwin-arm64, locale en-IN)
    • Flutter version 3.10.5 on channel stable at /Users/bijoy/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (4 weeks ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/bijoy/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.79.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.68.0

[✓] Connected device (4 available)
    • SM G990E (mobile)          • RZCW118D1XK                          • android-arm64  • Android 13 (API 33)
    • iPhone 14 Pro Max (mobile) • FE3A0644-69E3-4FE0-AA3B-A62AEA82C982 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 114.0.5735.198

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Minimal code example

Code sample
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final _formKey = GlobalKey<FormBuilderState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            FormBuilderFilePicker(
              name: "doc",
              maxFiles: 2,
              previewImages: true,
              onChanged: (val) => print(val),
              decoration: const InputDecoration(
                border: InputBorder.none,
              ),
              typeSelectors: const [
                TypeSelector(
                  type: FileType.media,
                  selector: Row(
                    children: <Widget>[
                      Icon(
                        Icons.add_circle,
                        color: Colors.white,
                      ),
                      Padding(
                        padding: EdgeInsets.only(left: 8.0),
                        child: Text(
                          "Add Passport Copy",
                          style: TextStyle(
                            color: Colors.white,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ],
              validator: FormBuilderValidators.compose([
                FormBuilderValidators.required(),
              ]),
              onFileLoading: (val) {
                print(val);
              },
            ),
          ],
        ),
      ),
    );
  }
}

Current Behavior

Automatically creating multiple duplicate fields

Screenshot_20230710_111700

Expected Behavior

Not create duplicate fields

Steps To Reproduce

Just add file picker field in a formbuilder

Aditional information

No response

issue with new version of file picker

form_builder_file_picker >=1.1.0 depends on flutter_form_builder ^5.0.0 and "PROJECT" depends on flutter_form_builder ^6.0.0-nullsafety.1, form_builder_file_picker >=1.1.0 is forbidden

No named parameter with the name 'fileExtension'

I have tried using the example code for form_builder_file_picker but it is resulting to the below error. Kindly assist

****/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/form_builder_file_picker-0.1.0/lib/src/form_builder_form_picker.dart:137:9: Error: No named parameter with the name 'fileExtension'.
        fileExtension: widget.fileExtension,
        ^^^^^^^^^^^^^
****/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/file_picker-1.9.0+1/lib/file_picker.dart:28:38: Context: Found this candidate, but the arguments don't match.
  static Future<Map<String, String>> getMultiFilePath(

form_builder_file_picker ^2.3.0 is incompatible with package_info_plus >=3.0.0

flutter pub get failed

I use
form_builder_file_picker: ^2.3.0
package_info_plus: ^3.0.2

Because no versions of form_builder_file_picker match >2.3.0 <3.0.0 and form_builder_file_picker 2.3.0 depends on file_picker ^4.6.1, form_builder_file_picker ^2.3.0 requires file_picker ^4.6.1.
And because no versions of file_picker match >4.6.1 <5.0.0, form_builder_file_picker ^2.3.0 requires file_picker 4.6.1.
And because file_picker 4.6.1 depends on ffi ^1.1.2 and package_info_plus >=3.0.0 depends on ffi ^2.0.1, form_builder_file_picker ^2.3.0 is incompatible with package_info_plus >=3.0.0.
So, because teleson_app_flutter depends on both package_info_plus ^3.0.2 and form_builder_file_picker ^2.3.0, version solving failed.
pub get failed (1; So, because teleson_app_flutter depends on both package_info_plus ^3.0.2 and form_builder_file_picker ^2.3.0, version solving failed.)
<<<

how can i load files as PlatformFile Type from file path and display them for edit purpose?

how can i load files as PlatformFile Type from file path and display them for edit purpose?

i have a path like: https://mydomains.com/medias/files/file.pdf or https://mydomains.com/medias/files/image.png
I've used form_builder_file_picker to upload multiple file to my server.

Now i have to load and display them for edit.
I've tried to convert the file as below

List<PlatformFile>? document;
_formatFile() async { PlatformFile? pfile; File file = File(filePath!); var bytes = await file.readAsBytes(); var name = file.path.split('/')[file.path.split('/').length - 1]; var size = bytes.length; pfile = PlatformFile(path: file.path, name: name, size: size); debugPrint(pfile.toString()); setState(() { document!.add(pfile!); }); }

this is the error that occurred:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PathNotFoundException: Cannot open file, path = 'https://mydomains/medias/files/apfr/299_APFR_BCST-50 manual-V23.pdf' (OS Error: No such file or directory, errno = 2) E/flutter (11435): #0 _checkForErrorResponse (dart:io/common.dart:55:9) E/flutter (11435): #1 _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)

it's about of this line: var bytes = await file.readAsBytes();

Is there an other way to do that?

Originally posted by @saifonglee in #67

No validation error is displayed

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?

Add option to define custom file viewer widget

Currently, there is no way to define a customized file viewer. In more complex use cases, this inflexibility is painful.

A few exemplary "more complex use cases":

  • Let the user pick a file, then give them the possibility to rename them without modifying the file on the local file system.
  • Add PlatformFile values to the FormBuilderFilePicker field value from another source than the internal picker (e.g: display picked files and photos picked from an image picker in the same list for better UI/UX)

[Request] Additional field for PlatformFile

Could you please add a additional placeholder field for PlatformFile?
I need a field to store the file ID (from database) value.
The field could be Object/Dynamic type, or even a Map<String, dynamic> so that multiple values can be stored.

Build problem on ios platform (pipeline)

Hi, need to update the dependencies, especially FilePicker 5.2.2 to catch up with flutter's official plugins like package_info_plus and device_info_plugin

Edit: Need solve the build problem on ios to release new version

Version conflict issues with Permission Handler Plugin (v9.0^)

Running "flutter pub get" in universal_service...
Because form_builder_file_picker 2.0.0 depends on permission_handler ^8.2.6 and no versions of form_builder_file_picker match >2.0.0 <3.0.0, form_builder_file_picker ^2.0.0 requires permission_handler ^8.2.6.
So, because test_app depends on both form_builder_file_picker ^2.0.0 and permission_handler ^9.2.0, version solving failed.
pub get failed (1; So, because test_app depends on both form_builder_file_picker ^2.0.0 and permission_handler ^9.2.0, version solving failed.)
exit code 1

Hi, I updated my permission handler plugin from version 8.3.0 to the latest version 9.0 and ran into the error above. I am unable to user the latest version of permission handler plugin because of Form Builder File Picker.

Flutter version I'm using is the latest 2.10

Thank you.

Setting maxFiles to null throwing Exception

Issue:

If we want to remove "#of file uploaded / maxFiles" Text from UI then we have to set maxFiles to null. Due to this ontap method of InkWell is throwing exception as it is trying to compare null with 0.

Stacktrace:

The following NoSuchMethodError was thrown building FormField<Map<String, String>>-[LabeledGlobalKey<FormFieldState>#b647b](dirty, dependencies: [_FormScope], state: FormFieldState<Map<String, String>>#2c7ea):
The method '<=' was called on null.
Receiver: null
Tried calling: <=(0)

_FormBuilderFilePickerState.build. (package:form_builder_file_picker/src/form_builder_form_picker.dart:108:62)

files reset when state change

Environment

Package version:
form_builder_file_picker: ^2.3.0

Flutter doctor
  • Doctor summary (to see all details, run flutter doctor -v):
  • [✓] Flutter (Channel stable, 3.7.0, on macOS 13.2 22D49 darwin-arm64, locale en-ID)
  • [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
  • [✓] Xcode - develop for iOS and macOS (Xcode 14.2)
  • [✓] Chrome - develop for the web
  • [✓] Android Studio (version 2022.1)
  • [✓] VS Code (version 1.75.0)
  • [✓] Connected device (3 available)
  • [✓] HTTP Host Availability
Code sample
if (type == 'filepicker') {
      return FormBuilderFilePicker(
        name: 'filepicker_datum$page',
        validator: FormBuilderValidators.required(errorText: 'Jawaban wajib diisi!'),
        decoration: const InputDecoration(labelText: 'Attachments'),
        maxFiles: 1,
        previewImages: true,
        onChanged: (val) {},
        typeSelectors: [
          TypeSelector(
            type: FileType.any,
            selector: Row(
              children: const <Widget>[
                Icon(Icons.attachment),
                Gap(8),
                Text('Pilih Berkas'),
              ],
            ),
          )
        ],
        onFileLoading: (val) {
          debugPrint(val.toString());
        },
        onSaved: (newValue) {},
        // customFileViewerBuilder: customFileViewerBuilder,
      );
    }

Description

i am using pageview, when finished fetching files, the list of files that have been fetxhed is reset to null.

Expected behavior:
file lists persists

Current behavior:
files reset

Video

jforms.mp4

unable to install the package...

Because form_builder_file_picker >=0.2.0 depends on flutter_form_builder ^3.10.0 and app depends on flutter_form_builder ^4.0.2, form_builder_file_picker >=0.2.0 is forbidden.

So, because app depends on form_builder_file_picker ^0.3.0, version solving failed.
pub get failed (1; So, because app depends on form_builder_file_picker ^0.3.0, version solving failed.)
exit code 1

Needs a license

Without a license it is difficult to know if it is safe to use this project. Looking forward to using this, once you have a license. Thanks.

Desktop support

Form Builder is awesome for forms and Flutter is awesome for building desktop apps. Forms are often a crucial part of any app.

It would be nice to have support for desktop (macos, linux, windows) out of the box for all fields. Could it be even made mandatory for Form Builder ecosystem? It's really dissapointing to see that some fields simply don't work on desktop.

Another issue is that there is no fundamental reason why they don't work. File pickers work perfectly on Flutter for desktops.

This issue has been tracked briefly here #23, and I'm still using my fork, but as I see this package is still listed as not supporting desktop.

What's needed to be done, so it supports desktop platforms?

Error: 'decoration' isn't a function or method and can't be invoked.

Hi, this error occurs when I try to use the extra plugin with the form_builder package

.../form_builder_file_picker-1.2.0-nullsafety.3/lib/src/form_builder_file_picker.dart:91:43: Error: 'decoration' isn't a function or method and can't be invoked.
              decoration: state.decoration(),

[Request] Add camera support

Can you please add the camera support?
Btw, the version of flutter_form_builder seems not up to date.

Many thanks in advance.

Null Safety

Will there be a null safe version of this package in the near future?

Android 13 Granular Permission Exception

Dear awesome Flutter Form Builder People!

Not sure how to fix this issue. I'm trying to open photos from my Android 13 device and getting an exception that Storage Permission is not granted. Do you maybe have an idea how to fix this behaviour?

Package version:

flutter_form_builder: ^7.8.0
form_builder_file_picker: ^2.4.0
form_builder_extra_fields: ^8.5.0

Flutter doctor
[✓] Flutter (Channel stable, 3.7.3, on macOS 13.2 22D49 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] IntelliJ IDEA Community Edition (version 2021.3)
[✓] VS Code (version 1.76.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Code sample

FormBuilderFilePicker(
name: 'fieldName,
onChanged: (value) {
//do something
},
typeSelectors: [
TypeSelector(
type: FileType.image,
selector: Row(
children: [
const Icon(
Icons.add_circle,
size: 20,
),
const SizedBox(width: 5),
Text(
'Choose Photo...',
),
],
),
),
],
onFileLoading: print,
)

Description

Expected behavior:

FormBuilderFilePicker checks for READ_MEDIA_IMAGES Permission

READ_MEDIA_IMAGES

Current behavior:

Exception gets thrown: Storage Permission not granted

Steps to reproduce

  1. Try to open Photo with FormBuilderFilePicker on ANDROID 13

Stacktrace/Logcat

Exception: Storage Permission not granted

Center TypeSelectors

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

4.1.0

What you'd like to happen

My design is to have a file selector form with the type selector horizontally centered, but it is always on the left.

Alternatives you've considered

No response

Aditional information

No response

Update file_picker to ^8.0.0

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

4.1.0

What you'd like to happen

Update file_picker to ^8.0.0

Alternatives you've considered

No response

Aditional information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.