flutter_dropzone icon indicating copy to clipboard operation
flutter_dropzone copied to clipboard

Mime type filter not working!

Open davsl opened this issue 3 years ago • 5 comments

If I set a mime type filter to the DropzoneView and then I try to drop an excluded file type, onLeave won't be called. This is a problem because I want to give the DropzoneView a different shade of color when hovering and the color never returns back to normal when the file is released. The other big problem with mime type filter is that it does not work when picking files using _dropController.pickFiles()

davsl avatar Dec 27 '21 18:12 davsl

As far as I can tell, the plugin does nothing with onLeave, just passes it on. Could it be that the browser doesn't send this event at all?

deakjahn avatar Dec 27 '21 21:12 deakjahn

The browser I'm using is Chrome, this problem occurs only if the file mime type is not handled by your widget.

davsl avatar Dec 30 '21 09:12 davsl

I can't reproduce this yet. I added

mime: const ['image/png'],

to the first drop zone in the example and tried to drop a JPG on it. This is what I got:

Untitled-1

Couple of left events for both zones, zone 1 didn't accept the JPG, zone 2 finally did.

deakjahn avatar Dec 30 '21 13:12 deakjahn

@davsl Any new developments? GitHub brought this up as a new notification but I don't know why. :-) As I showed, it seems to work for me.

deakjahn avatar Jan 20 '22 15:01 deakjahn

file filter works for me for both drag&drop and file picker. hint: supported mime files are set directly in pickFiles() function like: _controller!.pickFiles(mime: supportedDocumentsMimeTypes)

additionally, on leave also works for me even when im dragging not supported file type.

fralways avatar Jan 24 '22 12:01 fralways