DragAndDropLists constructor

DragAndDropLists({
  1. required List<DragAndDropListInterface> children,
  2. required OnItemReorder onItemReorder,
  3. required OnListReorder onListReorder,
  4. OnItemAdd? onItemAdd,
  5. OnListAdd? onListAdd,
  6. OnListDraggingChanged? onListDraggingChanged,
  7. ListOnWillAccept? listOnWillAccept,
  8. ListOnAccept? listOnAccept,
  9. ListTargetOnWillAccept? listTargetOnWillAccept,
  10. ListTargetOnAccept? listTargetOnAccept,
  11. OnItemDraggingChanged? onItemDraggingChanged,
  12. ItemOnWillAccept? itemOnWillAccept,
  13. ItemOnAccept? itemOnAccept,
  14. ItemTargetOnWillAccept? itemTargetOnWillAccept,
  15. ItemTargetOnAccept? itemTargetOnAccept,
  16. double? itemDraggingWidth,
  17. Widget? itemGhost,
  18. double itemGhostOpacity = 0.3,
  19. int itemSizeAnimationDurationMilliseconds = 150,
  20. bool itemDragOnLongPress = true,
  21. Decoration? itemDecorationWhileDragging,
  22. Widget? itemDivider,
  23. double? listDraggingWidth,
  24. Widget? listTarget,
  25. Widget? listGhost,
  26. double listGhostOpacity = 0.3,
  27. int listSizeAnimationDurationMilliseconds = 150,
  28. bool listDragOnLongPress = true,
  29. Decoration? listDecoration,
  30. Decoration? listDecorationWhileDragging,
  31. Decoration? listInnerDecoration,
  32. Widget? listDivider,
  33. bool listDividerOnLastChild = true,
  34. EdgeInsets? listPadding,
  35. Widget? contentsWhenEmpty,
  36. double listWidth = double.infinity,
  37. double lastItemTargetHeight = 20,
  38. bool addLastItemTargetHeightToTop = false,
  39. double lastListTargetSize = 110,
  40. CrossAxisAlignment verticalAlignment = CrossAxisAlignment.start,
  41. MainAxisAlignment horizontalAlignment = MainAxisAlignment.start,
  42. Axis axis = Axis.vertical,
  43. bool sliverList = false,
  44. ScrollController? scrollController,
  45. bool disableScrolling = false,
  46. DragHandle? listDragHandle,
  47. DragHandle? itemDragHandle,
  48. bool constrainDraggingAxis = true,
  49. bool removeTopPadding = false,
  50. Key? key,
})

Implementation

DragAndDropLists({
  required this.children,
  required this.onItemReorder,
  required this.onListReorder,
  this.onItemAdd,
  this.onListAdd,
  this.onListDraggingChanged,
  this.listOnWillAccept,
  this.listOnAccept,
  this.listTargetOnWillAccept,
  this.listTargetOnAccept,
  this.onItemDraggingChanged,
  this.itemOnWillAccept,
  this.itemOnAccept,
  this.itemTargetOnWillAccept,
  this.itemTargetOnAccept,
  this.itemDraggingWidth,
  this.itemGhost,
  this.itemGhostOpacity = 0.3,
  this.itemSizeAnimationDurationMilliseconds = 150,
  this.itemDragOnLongPress = true,
  this.itemDecorationWhileDragging,
  this.itemDivider,
  this.listDraggingWidth,
  this.listTarget,
  this.listGhost,
  this.listGhostOpacity = 0.3,
  this.listSizeAnimationDurationMilliseconds = 150,
  this.listDragOnLongPress = true,
  this.listDecoration,
  this.listDecorationWhileDragging,
  this.listInnerDecoration,
  this.listDivider,
  this.listDividerOnLastChild = true,
  this.listPadding,
  this.contentsWhenEmpty,
  this.listWidth = double.infinity,
  this.lastItemTargetHeight = 20,
  this.addLastItemTargetHeightToTop = false,
  this.lastListTargetSize = 110,
  this.verticalAlignment = CrossAxisAlignment.start,
  this.horizontalAlignment = MainAxisAlignment.start,
  this.axis = Axis.vertical,
  this.sliverList = false,
  this.scrollController,
  this.disableScrolling = false,
  this.listDragHandle,
  this.itemDragHandle,
  this.constrainDraggingAxis = true,
  this.removeTopPadding = false,
  Key? key,
}) : super(key: key) {
  if (listGhost == null &&
      children
          .where((element) => element is DragAndDropListExpansionInterface)
          .isNotEmpty)
    throw Exception(
        'If using DragAndDropListExpansion, you must provide a non-null listGhost');
  if (sliverList && scrollController == null) {
    throw Exception(
        'A scroll controller must be provided when using sliver lists');
  }
  if (axis == Axis.horizontal && listWidth == double.infinity) {
    throw Exception(
        'A finite width must be provided when setting the axis to horizontal');
  }
  if (axis == Axis.horizontal && sliverList) {
    throw Exception(
        'Combining a sliver list with a horizontal list is currently unsupported');
  }
}