dnd_kit 0.4.0
dnd_kit: ^0.4.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.
dnd_kit Example #
dnd_kit provides pure Dart geometry, collision, modifier, state, sensor,
registry, runtime, and diagnostics primitives. It has no Flutter dependency.
import 'package:dnd_kit/dnd_kit.dart';
void main() {
const activeRect = DndRect(left: 0, top: 0, width: 80, height: 40);
const droppableRects = <DndId, DndRect>{
DndId('todo'): DndRect(left: 0, top: 80, width: 240, height: 200),
DndId('done'): DndRect(left: 280, top: 80, width: 240, height: 200),
};
final collisions = DndCollisionDetectors.closestCenter(
const DndCollisionInput(
activeRect: activeRect,
droppableRects: droppableRects,
),
);
final overId = collisions.isEmpty ? null : collisions.first.id;
print('Dragging over: ${overId?.value}');
}
Use dnd_kit directly when you need testable drag/drop math or contracts
without Flutter widgets. For full Flutter scopes, draggables, droppables,
overlays, sensors, auto-scroll, and sortable presets, use
dnd_kit_flutter. For Jaspr web
apps, use dnd_kit_jaspr.