getCurrentListIndex static method

int getCurrentListIndex(
  1. TSelectionEntity? currentItem
)

确定当前 Item 在第几层级

Implementation

static int getCurrentListIndex(TSelectionEntity? currentItem) {
int listIndex = -1;
if (currentItem != null) {
  listIndex = 0;
  var parent = currentItem.parent;
  while (parent != null) {
    listIndex++;
    parent = parent.parent;
  }
}
return listIndex;
  }