Closed gbmiranda closed 11 months ago
I'm not really sure this would be a good idea, it was never intended that way. MIME types simply restrict the droppable files but don't necessarily mean a hard error. It would certainly be a breaking change if we modified that behavior now...
Hi, thanks for the quick response! Your arguments are valid, but we have some situations:
1- the onHover is called for files not accepted and I highlight the zone, if the user tries to add I have no event afterwards to remove the highlight and give a feedback warning that files are not accepted, maybe create a new event called onDropInvalid ? 2- another UX suggestion, when I place the file above the zone, the cursor shows a green icon, when for an invalid file, it displays a red icon.
I even managed to solve the hover issue by adding a MouseRegion over the zone and controlling it by onEnter / onExite, but I still haven't seen a way to display feedback to the user warning that the file is not accepted.
@gbmiranda Adding a new callback wasn't that complicated. Please, check it out.
Perfect thank you! Will you publish to pub.dev?
If you say it's safe to do so...
onDropInvalid event was not called :(
I tried the example, even left the MIME there for now and it works for me. Did you try that directly?
I tried it on my own project, here's a print of the code.
mime: ['image/jpeg', 'image/jpg', 'image/png'];
When I drop a CSV or ZIP file, the onDropInvalid event does not fire
Then first, please, try the example, that's the one we have in common...
if I download the example and run it, it works, but when I put it in my project with version 3.0.6 it doesn't. Even if I exactly copy your DropZone implementation the onDropInvalid event is not called.
Could it be that something was missing from the uploaded version?
Strange. All three seem to be upgraded:
Do check in your Pub\Cache\hosted\pub.dev
that you have these versions of all three.
I'll try to reproduce it in a standalone test in the meantime.
@gbmiranda I really can't get a handle on this yet. I started a new project, web only. I copied main.dart
from the plugin example. Here it is packed, I modified nothing else from the standard Flutter project template:
untitled.zip but it references the current version from Pub.dev.
And it runs just fine:
What you could do is to put a breakpoint here in your browser Dev Tools and see what really happens, step by step:
I'm thinking it's a flutter package caching problem... the file you sent me doesn't have the onDropInvalid handlers
For some reason I need to override flutter_dropzone_web to get the right version.
Working now!
I didn't yet change it to .10 in the .yaml
, that's true, but it should work, anyway, this is rather strange. What if you delete all the version folders in the pub cache and run pub get
again? Do you get version .10 then?
takes 3.0.9 and 3.0.10, but for some reason when I build it uses 3.0.9... it only works if I override it.
Who knows. I advanced the version now here and it will appear in the next published one.
Hi,
onLeave or onError is not being called after dropping a file not allowed by the mime type.
Any chance of correction?