ScrollableSortableLayer constructor

const ScrollableSortableLayer({
  1. Key? key,
  2. required Widget child,
  3. required ScrollController controller,
  4. double scrollThreshold = 50,
  5. bool overscroll = false,
})

Creates a ScrollableSortableLayer with automatic scrolling support.

Configures a sortable layer that provides automatic scrolling when dragged items approach the edges of the scrollable area.

Parameters:

  • key (Key?): Widget identifier for the widget tree
  • child (Widget, required): The scrollable widget containing sortable items
  • controller (ScrollController, required): The scroll controller to manage
  • scrollThreshold (double, default: 50.0): Distance from edges for scroll trigger
  • overscroll (bool, default: false): Whether to allow overscroll behavior

Example:

final controller = ScrollController();

ScrollableSortableLayer(
  controller: controller,
  scrollThreshold: 60.0,
  overscroll: true,
  child: ListView.builder(
    controller: controller,
    itemCount: items.length,
    itemBuilder: (context, index) => Sortable<Item>(
      data: SortableData(items[index]),
      child: ItemWidget(items[index]),
    ),
  ),
)

Implementation

const ScrollableSortableLayer({
  super.key,
  required this.child,
  required this.controller,
  this.scrollThreshold = 50,
  this.overscroll = false,
});