[desktop_drop] Add macOS app-wide and text drops#485
Open
omar-hanafy wants to merge 1 commit into
Open
Conversation
c2a9fb3 to
cf2aa14
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds macOS app-wide drop support to
desktop_drop, including files/folders opened through Finder, Open With, or the Dock icon, plus selected text/link drops through macOS Services.This also updates the package docs, changelog, and example app so the required macOS
Info.plistandAppDelegate.swiftwiring is visible in a working project.Branch:
desktop-drop-upstream-squashWhat Changed
DropTarget.catchAppWideDropsso a primary drop target can receive app-wide macOS drops that do not hover over the Flutter view first.DropItemsupport for dropped text/link payloads, plus helpers such asisMemoryBacked,isTextLike,readAsText(), andreadAsUris().desktop_dropexample app and wired the macOS example with the requiredCFBundleDocumentTypes,NSServices, and Services provider setup.desktop_drop0.8.0 changelog notes for the new user-facing behavior.Why
The previous
DropTargetpath only handled drops that entered the Flutter view. On macOS, users can also send content to an app at the application level by dropping files on the Dock icon, using Finder Open With, or dropping selected text/links through Services. Those paths can arrive before the Flutter UI is ready and do not have normal hover coordinates, so they need explicit buffering and an opt-in delivery path.Text/link drops also are not real file paths. They need to be exposed as memory-backed items with helper APIs so apps can distinguish them from filesystem drops and read their contents safely.
Validation
dart analyze packages/desktop_dropflutter test packages/desktop_dropNotes
The example app changes are intentionally larger than the plugin surface because the existing example was old and needed to be regenerated to demonstrate the new macOS global drop setup clearly.