dnd_kit 0.3.1 copy "dnd_kit: ^0.3.1" to clipboard
dnd_kit: ^0.3.1 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.

example/example.md

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.

3
likes
0
points
744
downloads

Publisher

unverified uploader

Weekly Downloads

Pure Dart core engine for the dnd_kit drag-and-drop family. Flutter apps use dnd_kit_flutter; Jaspr apps use dnd_kit_jaspr.

Homepage
Repository (GitHub)
View/report issues

Topics

#drag-and-drop #dnd #geometry #sortable

License

unknown (license)

Dependencies

collection, meta

More

Packages that depend on dnd_kit