flutter_dropzone icon indicating copy to clipboard operation
flutter_dropzone copied to clipboard

Proper example when there're other widgets in the `Stack` with `DropzoneView`

Open coder-with-a-bushido opened this issue 1 year ago • 2 comments

According to the example in the README, the right way to use the widget is -

Stack(
  children: [
    DropzoneView(...),
    Center(child: Text('Drop files here')),
  ],
)

In many cases, DropzoneView is used in Stack with other widgets on top of it but there no example for it. Something like -

Stack(
  children: [
    DropzoneView(...),
    // Other Widgets
    Center(child: Text('Drop files here')),
  ],
)

But when there's SelectionArea in the widget above it, for some reason DropzoneView doesn't seem to work above it.

coder-with-a-bushido avatar Nov 09 '23 08:11 coder-with-a-bushido

I solved this issue by keeping the DropzoneView on top of the rest of widgets and wrapping it with IgnorePointer. So, we could add an example in the README like -

Stack(
  children: [
    // Other Widgets
    IgnorePointer(
        child: DropzoneView(...),
    ),
    if(isHovered)
        Center(child: Text('Drop files here')),
  ],
)

Use the onHover, onDrop and onLeave and set the state for the variable isHovered

coder-with-a-bushido avatar Nov 09 '23 08:11 coder-with-a-bushido

You sir, are a genius. Thanks from Nigeria!

DavidOrakpo avatar Mar 11 '24 10:03 DavidOrakpo