deakjahn / flutter_dropzone

A drag-and-drop Flutter plugin (Web). Only web and only from outside into Flutter.
https://pub.dev/packages/flutter_dropzone
90 stars 41 forks source link

Mime type filter not working! #48

Open davsl opened 2 years ago

davsl commented 2 years ago

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()

deakjahn commented 2 years ago

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?

davsl commented 2 years ago

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

deakjahn commented 2 years ago

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 commented 2 years ago

@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.

fralways commented 2 years ago

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.