New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support drag and drop across Flutter boundary #30719
Comments
This should be extended to iPads as well. This doesn't exist on the iPhone but it does for iPad. If drag and drop is supported for the iPad then the Mac version will get it too: https://developer.apple.com/documentation/uikit/creating_a_mac_version_of_your_ipad_app/optimizing_your_ipad_app_for_mac Unless it is pure AppKit then it would have to be done separately I believe. |
Again, the macOS Flutter embedding does not use Catalyst. |
Correct. That’s why I included the last part. As of right now it does not use catalyst but it could change in the future. |
+1 |
Oh yes please! We need that! For browser apps it would be also very useful! @yjbanov are there any plans? |
Little example where we need that in a costumer project: |
We also need this support in flutter web. Shouldn't we add |
Do we have it already? As far as I know, we don't at the moment. I will build an e-commerce administration app (kind of an ERP and a CMS) where users can drag and drop folders and images into a box. Then, they will upload them from our custom server. Also, |
@mosheduminer i tried your snippet on web but its not working ... Can you share any gif of yours working ? The whole thing depend on I am using latest flutter dev channel |
@sh0umik, I made a gif, though it doesn't show much other than the console logging a file. I just pasted the code into a file, and used the DropZone component in the home page. So, I'm afraid I have no idea why it's not working for you. (I am using beta channel, though I don't think it should make a difference). |
+1 |
This sounds like a request for a plugin. I imagine each platform will have its own bespoke drag'n'drop API. For example, on the Web you can drag'n'drop files using this: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop |
I also have a need for this and can able develop the plugin for macOS. |
I would need some convincing that this should be a plugin rather than built into the embeddings. Drag and drop is a core interaction model on desktop, and something I would expect to be part of the framework. Also, I doubt there's a non-hacky way to do a good job of this with a plugin, at least on macOS, given the interaction necessary between native code and Flutter to handle widget location updates for anything beyond the overly-simplistic case of the entire Flutter view being a drag source and/or target. |
@mosheduminer yea got it working after static build of flutter web project or if i run without debug it works. Anyway it was a good hack but i would like to see it as a complete part of the engine. |
@stuartmorgan, where is the mobile/tablet version of this issue? Since the lack of this functionality there, is also present. Splitscreen on modern versions of Android as well as in iPadOS enables the need for this funcitonality on these platforms too. This ties together with @rodydavis comment earlier, in which he explains that this support should be carried to the iPad as well. Maybe a good idea would be to remove the "on desktop platforms" part of the title, and add the platform-android and platform-ios labels to the issue? If not so, explain why and point me in a different/better direction. |
@kenzieschmoll @stuartmorgan @mosheduminer
The Drag and Drop implementation works; however, I couldn't find a way The above code selects the whole body of the document, aka WebApp. So There must be some Widget that enables adding a property such as So
|
I just created my first package that allows native drag and drop support for iOS! (Hopefully android in the future) |
Thanks to @getBoolean's help there is now Android support! |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as duplicate.
This comment was marked as duplicate.
We created a plugin for native drag & drop support including drag-out to a folder or another application: |
Wow, wonderful!!! |
if you do windows please think about adding OLE support. (for the ability to drop files from apps like outlook) the following package works but only if the file exists in a path already. If you drag an email from outlook, for example, you would first have to drag it to the desktop or some other directory, and then to flutter. I can't find the developer's contact so I just leave it here in case it helps. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@faisalansari0367 this is unrelated to the issue. |
Please open this issue or guide me or help me to connect with someone who can help me giving me some suggestions to achieve this feature |
Anyone needed drag & drop in flutter might want to take a look at the super_drag_and_drop plugin. As far as I can tell it's the most comprehensive cross-platform drag and drop implementation out there. Apart from other things it supports virtual files (so for example on windows it should be able to read the dragged IStream from Outlook directly - exposing it as flutter Stream - @BananaMasterz) It also supports providing virtual files (on platforms where it is supported). So you can generate file content on demand. |
Thank you very much. Greatly appreciate your outstanding information!! |
THANK YOU for tagging me... I've been struggling with this for quite a while and didn't realize this plugin is now available. Love you |
This comment was marked as duplicate.
This comment was marked as duplicate.
We're happy to announce that the Flutter team has chosen to officially recommend super_drag_and_drop as the solution for implementing external drag and drop in Flutter applications! We find it to be a full-featured and mature package with a well designed API. The implementation of This is a clear example of the power of open source for projects such as Flutter, and frees the rest of the team to implement other priorities instead of spending engineer years replicating what @knopp (and his sponsor Superlist) have already built. Thanks Matej! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
For instance, it should be possible to have a Flutter widget that accepts image data, and to drag and drop an image from another application onto that widget.
This depends on #23603, but also requires some notion of a widget being able to declare itself as a drag target and/or source.
It's not entirely clear how much of this will need to be on the native side vs. the Dart side. I suspect dropping into the app will be easier to support than dragging out, but both will require careful thought about how to straddle the native/Dart divide (e.g., how to track rectangles for drag targets).
The text was updated successfully, but these errors were encountered: