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

add gestureRecognizers parameter in example #18

Closed rustiever closed 3 years ago

rustiever commented 3 years ago

so that it will be helpful how to implement them

Thank You

deakjahn commented 3 years ago

I can't really see much need for them at the present. The platform views support receiveing it, so I simply included that it can be passed but I'm not sure it serves any real purpose here. :-)

rustiever commented 3 years ago

I'm newbie, sorry if it was silly question, please tell me how can i achieve onTap on DropZoneView()

deakjahn commented 3 years ago

You don't. You wrap the whole thing into a GestureDetector and use that:

GestureDetector(
  onTap: () {},
  child: DropzoneView(
...

You'll get used to it. :-) This is the stardard way of doing things in Flutter, if you want to add some functionality (even if it's as simple as centering or aligning your widget to left or right), most of the time, you just wrap it into another widget with that functionality. You don't have to worry, that won't mean it will be slow if the tree is too deep. It's conceived this way and it does it rather well.

rustiever commented 3 years ago

Thank You so much for your help and example, So Kind of you brother

rustiever commented 3 years ago

But why gesturerecognizer parameter, if you don't mind, please explain me

deakjahn commented 3 years ago

Because, as I said above, the underlying platform view has such a parameter and the usual routine is to allow the user to pass in anything that might be passed on. I never tried if that could be used for any real purpose, especially considering that it requires a Set of Factory of recognizers, not just a single one...

rustiever commented 3 years ago

yeah buddy, i couldn't figure how to use ,but i'm happy with your ans and i got what i wanted and closing the issue

zeevgrim commented 1 year ago

There seems to be an issue with using GestureDetector in conjunction with DropzoneView. Specifically, wrapping DropzoneView with GestureDetector and providing an onTap callback does not work as expected:

GestureDetector(
  onTap: () {},
  child: DropzoneView(
    // ... other parameters
  ),
)

However, using the Listener widget with the onPointerDown callback as a workaround does function correctly:

Listener(
  onPointerDown: (details) {
    _pickFiles(); // Triggering the file picker when the area is tapped
  },
  child: DropzoneView(
    // ... other parameters
  ),
)

This suggests that DropzoneView might be consuming tap events, preventing GestureDetector from detecting them. A direct onTap or onClicked functionality for DropzoneView would be immensely helpful.