[desktop_drop] Capture DnD events in the visible page
Our app has a typical master-detail setup, where dragging files into the master page will create a new entry, and doing it on the detail page will add to the existing entry.
The problem we're having is that when we drag items into the detail page, the master page also reacts to the drag-and-drop events, despite being in the background.
I believe this is due to how the Flutter Navigator works. We're using Navigator.push() to load the detail page, but it seems the master page is still active in the background. Normally this isn't an issue since touch events are captured by the topmost page.
Is there any recommendation on how to get around this? Better would be if the DropTarget could capture and consume those events itself.
Since recreating a system similar to the click event handler is too complicated...
There is a simple way to handle this case:
disable the DropTarget in master page when detail page has been opened. (Just set the enable attribute of DropTarget to false.)
https://github.com/MixinNetwork/flutter-plugins/blob/777bd30145b01e04b047393d332bb09c0f87cf3b/packages/desktop_drop/lib/src/drop_target.dart#L18
Of course, if this does not solve the problem, we can also consider rebuilding a processing system similar to click event processing, but it may take a long time.
If you have more questions, please feel free to fill them here.
Hey thanks for the reply, I missed it because of vacation, but I'll try that.
In any case I think that making it analogue to click processing makes a lot of sense, since there are probably a number of use cases particularly in desktop where drop targets can overlap.
This package could use https://pub.dev/packages/visibility_detector to internally disable the drop zone automatically when the widget is not visible, then re-enable if it becomes visible.