flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

Fix: Allow developers to enable or disable drag-and-drop visual feedback.

Open sejong2401 opened this issue 1 year ago • 0 comments

Summary

  • This Pull Request addresses an issue with the drag-and-drop visual feedback in the desktop_drop package.
  • Drag-and-drop visual feedback refers to the feature where the mouse cursor changes to a + shape when files are dragged over the app window, and files appear to be dropped onto the app window when the mouse button is released.

Issue

  • In applications without drag-and-drop functionality, the mouse cursor does not change to a + shape, and files return to their original position when the mouse button is released.
  • With the desktop_drop package implemented, the drag-and-drop visual feedback is activated even if the DropTarget widget is not present. This can mislead users into thinking that the app supports drag-and-drop functionality when it does not.

Details

  • This update allows developers to control whether drag-and-drop visual feedback is enabled or disabled.

Usage

  • To enable or disable drag-and-drop visual feedback, use the following code in your widget:
@override
void initState() {
  DesktopDrop.instance.enableDragDropVisualFeedback();
  super.initState();
}

@override
void dispose() {
  DesktopDrop.instance.disableDragDropVisualFeedback();
  super.dispose();
}

Limitations

  • This implementation applies only to macOS. Support for Linux and Windows is not included.
  • The feedback is applied at the page level. Consideration is needed for implementing this at a more granular level within parts of a page.

sejong2401 avatar Aug 31 '24 07:08 sejong2401