onLongpressCard method

void onLongpressCard({
  1. required int listIndex,
  2. required int itemIndex,
  3. required BuildContext context,
  4. required VoidCallback setsate,
})

Implementation

void onLongpressCard(
    {required int listIndex,
    required int itemIndex,
    required BuildContext context,
    required VoidCallback setsate}) {
  var prov = ref.read(ProviderList.boardProvider);
  var box = context.findRenderObject() as RenderBox;
  var location = box.localToGlobal(Offset.zero);
  prov.board.lists[listIndex].items[itemIndex].x =
      location.dx - prov.board.displacementX!;
  prov.board.lists[listIndex].items[itemIndex].y =
      location.dy - prov.board.displacementY!;
  // prov.board.lists[listIndex].items[itemIndex].width = box.size.width;
  // prov.board.lists[listIndex].items[itemIndex].height = box.size.height;
  prov.updateValue(
      dx: location.dx, dy: location.dy - prov.board.displacementY!);
  prov.board.dragItemIndex = itemIndex;
  prov.board.dragItemOfListIndex = listIndex;
  prov.board.isElementDragged = true;
  prov.draggedItemState = DraggedItemState(
      child: SizedBox(
        width:
            prov.board.lists[listIndex].items[itemIndex].context!.size!.width,
        child: prov.board.lists[listIndex].items[itemIndex].child,
      ),
      listIndex: listIndex,
      itemIndex: itemIndex,
      height: box.size.height - 10,
      width: box.size.width,
      x: location.dx,
      y: location.dy);
  prov.draggedItemState!.setState = setsate;
  // log("${listIndex} ${itemIndex}");
  setsate();
}