Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion Box #99

Closed
1 of 6 tasks
miguelpruivo opened this issue Jun 20, 2019 · 74 comments
Closed
1 of 6 tasks

Suggestion Box #99

miguelpruivo opened this issue Jun 20, 2019 · 74 comments
Assignees
Labels
discussion General discussion suggestion New feature or request

Comments

@miguelpruivo
Copy link
Owner

miguelpruivo commented Jun 20, 2019

Suggestions Box

Please, if you have any suggestion add it here and I'll try to keep track of those, as well we can try to discuss which will make sense to implement or not in the package.

The list order is from the most likely to be added to the less.

To-do list

@davidmartos96
Copy link

+1 For Flutter desktop support

@miguelpruivo miguelpruivo changed the title Suggestions Box Suggestion Box Jun 22, 2019
@chunhunghan
Copy link

chunhunghan commented Jun 25, 2019

Please add directory selection, so go-flutter-desktop file_picker plug-in can add this new feature.
Please see the follwing comments.
go-flutter-desktop/plugins#3 (comment)
Thanks

@tolstenko
Copy link

Flutter Desktop support would be amazing! :-)

@pavanvora
Copy link

Please add support for multiple fileType in singleFilePath.

e.g.
I want to select a single file which can be either IMAGE or PDF. I know I can use CUSTOM fileType but I don't user to select any other fileType then IMAGE and PDF.

@thejacer87
Copy link

+1 for #68

@miguelpruivo
Copy link
Owner Author

@tolstenko desktop is already in progress, see discussion here.

@stuartmorgan
Copy link

desktop is already in progress, see discussion here.

The discussion you linked to is about the go-flutter-desktop project. The Flutter desktop support that was requested in #85 specifically referred to the Flutter project's in-development support for desktop (which is probably what people referring to Flutter desktop are likely to mean unless they specifically mention a community project like go-flutter-desktop or flutter-rs).

Those two things have completely separate plugin APIs, tooling, and even languages, and thus require completely different implementations.

@miguelpruivo
Copy link
Owner Author

@stuartmorgan oh, right! Now I get why you were referring to desktop-go instead of just desktop.

That’s great anyway, somehow I thought you were already developing a file picker for a desktop flutter shell and you’d want to merge it with this package.

@stuartmorgan
Copy link

There is actually already a file picker plugin for desktop Flutter (macOS and Linux so far, Windows to be implemented). It may actually become part of Flutter for desktop itself in the future, but in the meantime if someone wants to make (non-Go) desktop implementations of this plugin for API compatibility reasons it could be used as a starting point.

@NewITCorp
Copy link

+1 for Picking directory please

@stuartmorgan
Copy link

Just to re-iterate from my comment above: you've marked #85 as done in the checklist, but what was landed in the recent PR is not what was requested in #85.

@miguelpruivo
Copy link
Owner Author

Yes I’m aware of that @stuartmorgan. It’s not the flutter desktop but it’s a desktop implementation anyway, that’s why in the details it is mentioned that is done through go-flutter.

@stuartmorgan
Copy link

It’s not the flutter desktop but it’s a desktop implementation anyway

So does that mean #85 is a wont-fix?

@rlee1990
Copy link

rlee1990 commented Feb 4, 2020

@miguelpruivo I import it the way @guiguan suggested

@miguelpruivo
Copy link
Owner Author

@rlee1990 I don't get it then. Check answer above, do you have to cast it or not? 😄

@rlee1990
Copy link

rlee1990 commented Feb 4, 2020

@miguelpruivo you do not if you type it like this:
final List files = await FilePicker.getFilesForWeb(); it will work with no issue

@miguelpruivo
Copy link
Owner Author

@rlee1990 what's the exception thrown if you do:

List<html.File> files = await FilePicker.getFilesForWeb(); 

@rlee1990
Copy link

rlee1990 commented Feb 4, 2020

I get this:
`A value of type 'List (where File is defined in D:\nexttech\flutter_windows_v1.5.4-hotfix.2-stable\flutter\bin\cache\pkg\sky_engine\lib\html\html_dart2js.dart)' can't be assigned to a variable of type 'List (where File is defined in D:\nexttech\flutter_windows_v1.5.4-hotfix.2-stable\flutter.pub-cache\hosted\pub.dartlang.org\universal_html-1.1.12\lib\src\html\api\file.dart)'. Try changing the type of the variable, or casting the right-hand type to 'List (where File is defined in D:\nexttech\flutter_windows_v1.5.4-hotfix.2-stable\flutter.pub-cache\hosted\pub.dartlang.org\universal_html-1.1.12\lib\src\html\api\file.dart)'.

`
@miguelpruivo

@miguelpruivo
Copy link
Owner Author

Hum, I get it @rlee1990. We are using different File imports. Just use the same and you should be fine. Are you using: import 'dart:html' as html;?

@pedia
Copy link

pedia commented Feb 11, 2020

How about add and argument for Recent Folder? Just like

static Future<File> getFile({
  FileType type = FileType.ANY, 
  String fileExtension, 
  String recentFolder, // recent folder,  default null
});

static Future<String> getFilePath({
  FileType type = FileType.ANY, 
  String fileExtension,
  String recentFolder, // recent parent folder,  default null
})

It's very popular feature in desktop. Maybe very useful in Android too.

@guit4eva
Copy link

I'm getting the following error:

Error: Expected a value of type 'File', but got one of type 'File$'

with:

Future<void> pickImage({Function callback, Function callbackSetTmpImgFile}) async {
  try {
    final List selectedImageFile = await FilePicker.getFilesForWeb();
    cropImage(selectedImageFile[0], callback, callbackSetTmpImgFile);
  } catch (e) {
    print("Error: $e");
  }
}

@miguelpruivo
Copy link
Owner Author

miguelpruivo commented Feb 11, 2020

@pedia I'm afraid that would not result in any change on iOS and I want to make this plugin as seamless as possible platform wise.

Might make some sense on Desktop though.

@guit4eva that should only work when running on Flutter Web. Are. you using with it?

@pedia
Copy link

pedia commented Feb 12, 2020

@miguelpruivo Make this an optional argument? There is no harm to iOS.

@guit4eva
Copy link

@pedia I'm afraid that would not result in any change on iOS and I want to make this plugin as seamless as possible platform wise.

Might make some sense on Desktop though.

@guit4eva that should only work when running on Flutter Web. Are. you using with it?

@miguelpruivo Yes, this error occurs when running the web version (Chrome).

@deacon78
Copy link

@miguelpruivo
Could you add the file save dialog functionality ?
I am looking for a way to export a file and let the user save it wherever he wants to.
The idea is to open the native file explorer and the user save the file where he wants.
For exemple Google Drive if he wants to...

The package " https://pub.dev/packages/flutter_file_dialog" open the dialog to save a file, but it make the app crash....and the file is not saved.

Thanks

@deacon78
Copy link

flutter_file_picker does not prevent picking files with another extension when using the filter on extension.

@ppcapel
Copy link

ppcapel commented Mar 6, 2020

Is it possible to set the Image Quality, as we have in image_picker package?

@miguelpruivo
Copy link
Owner Author

@ppcapel that image quality you’re referring to is for the camera capture image quality. Since this plugin doesn’t use camera at all (only picking files) I would say that it doesn’t make much sense here.

The same goes for the image picker, I believe that image quality is only applied when taking new pictures and not from those picked from gallery.

@ppcapel
Copy link

ppcapel commented Mar 7, 2020

@ppcapel that image quality you’re referring to is for the camera capture image quality. Since this plugin doesn’t use camera at all (only picking files) I would say that it doesn’t make much sense here.

The same goes for the image picker, I believe that image quality is only applied when taking new pictures and not from those picked from gallery.

@miguelpruivo in the image_picker the quality can be set to picked images too...
It works very well. It helps a lot to manage firebase storage upload sizes...

/// The imageQuality argument modifies the quality of the image, ranging from 0-100
/// where 100 is the original/max quality. If imageQuality is null, the image with
/// the original quality will be returned. Compression is only supportted for certain
/// image types such as JPEG. If compression is not supported for the image that is picked,
/// an warning message will be logged.

@crtl
Copy link

crtl commented Mar 10, 2020

It would be nice to add FileType.CAMERA to allow making a photo or video with the camera and return it.
image_picker has support for Camera input but does not support video.

@miguelpruivo
Copy link
Owner Author

@crtl I understand. Early versions of file picker had camera support, due to direct integration with image_picker, but then, it would force users that use file_picker to pick files, despite of using camera or not, to have the camera entitlements when publishing to the store and that could result in undesired install permissions. Also, that would require two plugins to be synced with each other, whereas now you could just use image_picker and file_picker and have a more granular control with what/when to use.

@AirborneEagle
Copy link

AirborneEagle commented Mar 25, 2020

@miguelpruivo
I my flutter app is already in production. We are adding a feature that requires file uploading (csv files specifically) on the web. I tried what you suggested above

await FilePicker.getFilesForWeb();
  file_picker:
    git:
      url: https://github.com/miguelpruivo/plugins_flutter_file_picker.git
      ref: web-support

to no avail. It fails to compile with this error:

Compiler message:
../../../../.pub-cache/git/plugins_flutter_file_picker-1bf86d9fc5f3292ddbca0207bc90dc1af0598fb3/lib/file_picker.dart:26:81: Error: Getter not found: 'ANY'.
  static Future<Map<String, String>> getMultiFilePath({FileType type = FileType.ANY, String fileExtension}) async =>
                                                                                ^^^
../../../../.pub-cache/git/plugins_flutter_file_picker-1bf86d9fc5f3292ddbca0207bc90dc1af0598fb3/lib/file_picker.dart:34:63: Error: Getter not found: 'ANY'.
  static Future<String> getFilePath({FileType type = FileType.ANY, String fileExtension}) async =>
                                                              ^^^
../../../../.pub-cache/git/plugins_flutter_file_picker-1bf86d9fc5f3292ddbca0207bc90dc1af0598fb3/lib/file_picker.dart:41:57: Error: Getter not found: 'ANY'.
  static Future<File> getFile({FileType type = FileType.ANY, String fileExtension}) async {
                                                        ^^^
../../../../.pub-cache/git/plugins_flutter_file_picker-1bf86d9fc5f3292ddbca0207bc90dc1af0598fb3/lib/file_picker.dart:62:68: Error: Getter not found: 'ANY'.
  static Future<List<File>> getMultiFile({FileType type = FileType.ANY, String fileExtension}) async {
                                                                   ^^^
Failed to compile application.

I am happy to contribute to this package, and would like to do so right away. The best other option I have is to use another dart package that was updated sometime early last year.(called file_picker_cross. based off your package)

The problem seem to be that the default FileType value is FileType.ANY but the enum actual value is FileType.any

I changed all instances of FileType.ANY to FileType.any and it compiled and worked fine.

@miguelpruivo
Copy link
Owner Author

@AirborneEagle as pointed here in the CHANGELOG 1.5.0 introduced a breaking change that is renaming the enum for camelCase instead of upper case, thus, you must indeed refactor your code as well.

That web-support branch is unstable, but I've plans to introduce web support and already wrapped the code, although, not as complete as mobile version in the first stages.

Thanks!

@AirborneEagle
Copy link

Thank you. 👍
I look forward to it, and if there are ways I may be able to help, let me know.

@miguelpruivo
Copy link
Owner Author

miguelpruivo commented Apr 5, 2020

As of now, with version 1.6.0 released just now you can start filtering multiple extensions at once. There are breaking changes, so have in mind that from now on you'll need to provide an List of file types instead of a single one with FileType.custom.

Example:

 List<File> files = await FilePicker.getMultiFile(
          type: FileType.custom,
          allowedExtensions: ['jpg', 'pdf', 'doc'],
        );

Web support is coming soon as well (already in progress).

I'm closing this in favor of individual issues for each requested feature (tagged with [Feature]).
Thank you.

@miguelpruivo miguelpruivo unpinned this issue Apr 5, 2020
@rmsh03dhj
Copy link

How do I limit the number of files selection and their size? For example, I want to bound user to select 5 files only and each files cannot be more than 5Mb.

@miguelpruivo
Copy link
Owner Author

@rmsh03dhj you can’t do it as far as it concerns to native file explorer apps. They would have to support it — which they don’t.

Because of that, and IMO, it’s even a better option, you can just iterate over the picked files and check if they meet your requirements. If they don’t, show an alert/error and discard the files.

@rmsh03dhj
Copy link

@miguelpruivo Thanks for the reply. Will try to go as per your suggestion.

@yingshaoxo
Copy link

It's going to be right if we only allow directory selection on the desktop tunnel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion General discussion suggestion New feature or request
Projects
None yet
Development

No branches or pull requests