SortableLayer constructor

const SortableLayer({
  1. Key? key,
  2. bool lock = false,
  3. Clip? clipBehavior,
  4. Duration? dropDuration,
  5. Curve? dropCurve,
  6. required Widget child,
})

Creates a SortableLayer to manage drag-and-drop operations.

Configures the layer that coordinates drag sessions between sortable widgets and provides the rendering context for drag operations.

Parameters:

  • key (Key?): Widget identifier for the widget tree
  • child (Widget, required): The widget tree containing sortable widgets
  • lock (bool, default: false): Whether to constrain dragging within bounds
  • clipBehavior (Clip?, optional): How to clip the layer content
  • dropDuration (Duration?, optional): Duration for drop animations
  • dropCurve (Curve?, optional): Curve for drop animation easing

Example:

SortableLayer(
  lock: true,
  dropDuration: Duration(milliseconds: 250),
  dropCurve: Curves.easeInOutCubic,
  child: ListView(
    children: sortableItems.map((item) => Sortable(...)).toList(),
  ),
)

Implementation

const SortableLayer({
  super.key,
  this.lock = false,
  this.clipBehavior,
  this.dropDuration,
  this.dropCurve,
  required this.child,
});