dnd_kit 0.6.0
dnd_kit: ^0.6.0 copied to clipboard
Pure Dart core engine for the dnd_kit drag-and-drop family. Flutter apps use dnd_kit_flutter; Jaspr apps use dnd_kit_jaspr.
Changelog #
0.6.0 #
Fixes four defaults reported by a production integration; see
docs/decisions/0024-drag-defaults-match-what-users-see.md.
- Breaking behavior: the active draggable is no longer a collision
candidate.
DndCollisionInput.droppableRectsexcludes the active id, sooverIdcan never equalactiveIdand drops near the source slot commit instead of silently resolving to no move. Custom detectors no longer need to filter the active item themselves. - Breaking behavior:
beginDragmarks all measurements dirty, so a drag started in a scrolled viewport measures targets at their current positions instead of reusing rects captured at registration. - Adds
SortableStrategies.dropOnOver, which commits the move at the drop-over target so the drop lands where theisOverhighlight is. The geometric strategies keep resolving from the dragged rect's center and now document that they can disagree with the highlight. - Adds
DndRuntime.initialActiveRect, the active rectangle measured at drag start and fixed for the session, so drag previews survive a collapsed source slot.
Live sortable feedback, added in the same line; see
docs/decisions/0025-sortable-live-preview-and-offsets.md.
- Adds
SortableDragContextandSortableResolutionPhase, so a sortable strategy runs both while a drag moves (preview) and when it ends (commit) through one code path. The preview a UI shows and the move that is finally reported are therefore the same computation. - Deprecated:
SortableStrategyInput.eventandSortableMultiMoveInput.event. Both are now getters that return null during a preview; usecontextinstead. They will be removed in a future release. - Adds
SortablePreview, which reports where the active item would land if released now. It resolves lazily and caches per move, so reading it from every item in a list costs one resolution. - Adds
SortableOffsetResolver,SortableOffsetInput, and theSortableOffsets.verticalList/horizontalList/nonebuilt-ins, which report how far each item a move displaces should shift.noneis the default: the library reports geometry and the application decides whether to animate it. - Adds
SortableMultiOffsetResolver,SortableMultiOffsetInput, and theSortableMultiOffsets.verticalLists/horizontalLists/nonebuilt-ins for boards: a same-container move matches the single-list result, and a cross-container move closes the source column and opens the target column. Seedocs/decisions/0026-cross-container-sortable-offsets.md.
Multi-container refinements from live testing.
DndRuntime.collisionDetectoris now settable (was final), and its constructor argument is optional._updateCollisionreads it on every move, so a surface such asSortableMultiScopecan install its board detector on a controller the application created.SortableMultiContainer.collisionDetectordecides before/after an item from the pointer's position within the hovered card, not the dragged rect's center, so cross-container insertion no longer flips with the grab offset. The gap between two cards, and the trailing space below the last card, resolve to the nearest card instead of to the whole column.SortableMultiContainer.resolveMovereports no move while the pointer is still inside the dragged item's own original slot (which stays fixed for the drag). Picking an item up no longer shifts its neighbours, and releasing without leaving the slot no longer reorders — in both preview and commit.
0.5.0 #
- Adds
DndCollisionInput.activeId: the id of the draggable being moved is now passed to collision detectors, so a custom detector can scope candidates to the active item's kind (e.g. two nested sortable contexts sharing one controller that must ignore each other's droppables).
0.4.0 #
- Graduates multi-container from a helper-only contract into a supported shared engine feature for the common board/list case.
SortableMultiContainernow owns the default collision detector and move-intent resolution policy, including empty-container drops and adaptive before/after insertion around an over-item target.- Adds
SortableMultiMoveInputandSortableMultiMoveResolverso adapters and advanced consumers can override the default policy without forking the whole feature. - Adds the experimental multi-container helper contract to the shared engine:
SortableContainerandSortableMultiContainernow live inpackage:dnd_kit/dnd_kit.dartso Flutter and Jaspr apps compute the same cross-container move intent over one pure-Dart source of truth.
0.3.2 #
- Updates the pub.dev homepage metadata to the hosted project website while keeping repository and issue tracker links on GitHub.
- Refreshes the package links for the repository transfer to
iamv4g/dnd_kit.
0.3.1 #
- Adds
DndAnnouncementsto the shared engine as a framework-neutral accessibility contract for drag start/over/end/cancel announcements. - Flutter and Jaspr adapters now reuse the shared contract from
dnd_kitinstead of maintaining duplicate pure-Dart announcement builders.
0.3.0 #
- Package identity change.
dnd_kitis now the pure Dart core engine of the toolkit — the package formerly published asdnd_kit_core. The API surface is unchanged fromdnd_kit_core 0.2.0-dev.0; only the package name and import path changed (package:dnd_kit_core/dnd_kit_core.dart→package:dnd_kit/dnd_kit.dart). - The earlier
dnd_kit0.1.xreleases were the Flutter umbrella that re-exporteddnd_kit_flutter. That umbrella role is discontinued: Flutter apps now depend ondnd_kit_flutterand importpackage:dnd_kit_flutter/dnd_kit_flutter.dart; Jaspr apps depend ondnd_kit_jaspr. Both adapters build on this engine. dnd_kit_coreis discontinued and superseded by this package. See ADR 0017 for the rationale and the brand-as-core decision that supersedes ADR 0014.- Adds additive axis-aware shared auto-scroll math via
DndScrollAxisand anaxisparameter ondndAutoScrollVelocity(...). Vertical behavior remains the default; both the Flutter and Jaspr adapters now execute against this contract.
0.2.0-dev.0 #
- Starts the shared-runtime development line for
dnd_kit_core. - Adds
DndRuntimeas the framework-neutral drag engine shared by the Flutter and Jaspr adapters. - Moves
DndMeasuringRegistryand its measurement-status contract into core so adapters can share the same measuring cache model. - Moves
DndPointerSensorto core on top ofDndRuntime, preserving the pointer-activation state machine across adapters. - Brings the shared sortable move/strategy math and auto-scroll edge/velocity math into core for reuse outside Flutter.
0.1.0 #
- First public release of the pure Dart engine: stable identifiers, geometry, drag state and events, collision detectors, modifiers, sensor and registry contracts, and diagnostics.
DndRegistry.registerDraggable/registerDroppableand their unregister counterparts accept an optionalowner. Owner-aware registration is last-wins and lets a new owner take over an id without tripping duplicate detection — required so draggables in a lazyListView.buildersurvive the list rebuilding a keyed entry (new element mounts before the old is disposed). A departing owner can no longer remove a registration that a newer owner already took over.- Owner-aware entries now also keep per-id owner claims and emit a deferred duplicate warning when multiple owners still claim the same id after reconciliation. This restores actionable duplicate diagnostics for owner-registered entries without reintroducing the lazy-list remount crash.
- Calls without
ownerkeep the strict duplicate-id debug assertion and immediate warning behavior for directDndRegistryusage.
0.1.0-dev.1 #
- Added a package-local
example/example.mdso pub.dev can render a compact illustrative pure Dart example for the package.
0.1.0-dev.0 #
- Initial development release of the pure Dart
dnd_kit_corepackage. - Includes stable ID, geometry, drag state, drag event, collision detector, modifier, sensor, registry, and diagnostics primitives.
- Keeps Flutter,
dart:ui, widget, render object, gesture, overlay, and app state-management dependencies out of the core package.