getYAxisCondition method

bool getYAxisCondition({
  1. required int listIndex,
  2. required int itemIndex,
})

Implementation

bool getYAxisCondition({required int listIndex, required int itemIndex}) {
  var prov = ref.read(ProviderList.boardProvider);
  var item = prov.board.lists[listIndex].items[itemIndex];
  var willPlaceHolderAtBottom = ((itemIndex ==
          prov.board.lists[listIndex].items.length - 1) &&
      ((prov.draggedItemState!.height * 0.6) + prov.valueNotifier.value.dy >
          item.y! + item.height!));

  var willPlaceHolderAtTop =
      ((prov.valueNotifier.value.dy < item.y! + (item.height! * 0.5)) &&
          (prov.draggedItemState!.height + prov.valueNotifier.value.dy >
              item.y! + (item.height! * 0.5)));

  //  log("$willPlaceHolderAtBottom === $willPlaceHolderAtTop");

  return (((willPlaceHolderAtTop || willPlaceHolderAtBottom) &&
          prov.board.dragItemOfListIndex! == listIndex) && //true
      (prov.board.dragItemIndex != itemIndex ||
          (willPlaceHolderAtBottom &&
              !prov.board.lists[listIndex].items[itemIndex]
                  .bottomPlaceholder!) ||
          (prov.board.lists[listIndex].items[itemIndex].bottomPlaceholder! &&
              (itemIndex == prov.board.lists[listIndex].items.length - 1 ||
                  itemIndex ==
                      prov.board.lists[listIndex].items.length - 1))));
}