addPlaceHolder method

void addPlaceHolder({
  1. required int listIndex,
  2. required int itemIndex,
})

Implementation

void addPlaceHolder({required int listIndex, required int itemIndex}) {
  var prov = ref.read(ProviderList.boardProvider);
  var item = prov.board.lists[listIndex].items[itemIndex];
  item.containsPlaceholder = true;
  item.child = Column(
    children: [
      !item.bottomPlaceholder!
          ? Container(
              decoration: BoxDecoration(
                border: Border.all(color: Colors.grey.shade200),
                borderRadius: BorderRadius.circular(4),
                color: item.backgroundColor ?? Colors.white,
              ),
              margin: const EdgeInsets.only(
                bottom: 10,
              ),
              width: prov.draggedItemState!.width,
              height: prov.draggedItemState!.height,
            )
          : Container(),
      Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(4),
          color: item.backgroundColor ?? Colors.white,
        ),
        width: item.actualSize!.width,
        child: item.prevChild,
      ),
      item.bottomPlaceholder!
          ? Container(
              decoration: BoxDecoration(
                border: Border.all(color: Colors.grey.shade200),
                borderRadius: BorderRadius.circular(4),
                color: item.backgroundColor ?? Colors.white,
              ),
              margin: EdgeInsets.only(
                  bottom: 10,
                  top: prov.board.lists[listIndex].items.length - 1 ==
                          itemIndex
                      ? 10
                      : 0),
              width: prov.draggedItemState!.width,
              height: prov.draggedItemState!.height,
            )
          : Container(),
    ],
  );
}