HcDragAndDropView.horizontal constructor

const HcDragAndDropView.horizontal({
  1. Key? key,
  2. bool reverse = false,
  3. ScrollController? controller,
  4. bool? primary,
  5. ScrollPhysics? physics,
  6. bool isCustomFeedback = false,
  7. bool isCustomChildWhenDragging = false,
  8. required WillAcceptCallback onWillAccept,
  9. required ReorderCallback onReorder,
  10. EdgeInsetsGeometry? padding,
  11. required SliverGridDelegate gridDelegate,
  12. required IndexedWidgetBuilder itemBuilder,
  13. int? itemCount,
  14. bool addAutomaticKeepAlives = true,
  15. bool addRepaintBoundaries = true,
  16. bool addSemanticIndexes = true,
  17. double? cacheExtent,
  18. int? semanticChildCount,
  19. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  20. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
  21. WidgetPositionBuilder? feedback,
  22. WidgetPositionBuilder? childWhenDragging,
})

This constructor use to achive the Horizontal Reorderable / Re-Indexing feature in DragAndDropGridView. Providing a non-null itemCount improves the ability of the GridView to estimate the maximum scroll extent.

itemBuilder will be called only with indices greater than or equal to zero and less than itemCount.

The gridDelegate argument must not be null.

The addAutomaticKeepAlives argument corresponds to the SliverChildBuilderDelegate.addAutomaticKeepAlives property. The addRepaintBoundaries argument corresponds to the SliverChildBuilderDelegate.addRepaintBoundaries property. Both must not be null. this onReorder have the old index and new index. Called when an acceptable piece of data was dropped over this grid child. onWillAccept this funciton allows you to validate if you want to accept the change in the order of the gridViewItems. If you always want to accept the change simply return true

Implementation

const HcDragAndDropView.horizontal({
  Key? key,
  bool reverse = false,
  ScrollController? controller,
  bool? primary,
  ScrollPhysics? physics,
  bool isCustomFeedback = false,
  bool isCustomChildWhenDragging = false,
  required WillAcceptCallback onWillAccept,
  required ReorderCallback onReorder,
  EdgeInsetsGeometry? padding,
  required SliverGridDelegate gridDelegate,
  required IndexedWidgetBuilder itemBuilder,
  int? itemCount,
  bool addAutomaticKeepAlives = true,
  bool addRepaintBoundaries = true,
  bool addSemanticIndexes = true,
  double? cacheExtent,
  int? semanticChildCount,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  ScrollViewKeyboardDismissBehavior keyboardDismissBehavior =
      ScrollViewKeyboardDismissBehavior.manual,
  WidgetPositionBuilder? feedback,
  WidgetPositionBuilder? childWhenDragging,
}) : super(
        key: key,
        reverse: reverse,
        itemBuilder: itemBuilder,
        onWillAccept: onWillAccept,
        feedback: feedback,
        onReorder: onReorder,
        childWhenDragging: childWhenDragging,
        controller: controller,
        padding: padding,
        semanticChildCount: semanticChildCount,
        physics: physics,
        addAutomaticKeepAlive: addAutomaticKeepAlives,
        addRepaintBoundaries: addRepaintBoundaries,
        addSemanticIndexes: addSemanticIndexes,
        cacheExtent: cacheExtent,
        itemCount: itemCount,
        primary: primary,
        isCustomFeedback: isCustomFeedback,
        isCustomChildWhenDragging: isCustomChildWhenDragging,
        gridDelegate: gridDelegate,
        dragStartBehavior: dragStartBehavior,
        keyboardDismissBehavior: keyboardDismissBehavior,
        isVertical: false,
      );