getSelectedItemCount method

String getSelectedItemCount(
  1. SelectionEntity item
)

获取当前节点的子节点中,选中的数量

Implementation

String getSelectedItemCount(SelectionEntity item) {
  String itemCount = "";
  if ((SelectionUtil.getTotalLevel(item) < 3 || !isFirstLevel) &&
      item.children.isNotEmpty) {
    int count =
        item.children.where((f) => f.isSelected && !f.isUnLimit()).length;
    if (count > 1) {
      return '($count)';
    } else if (count == 1 && item.hasCheckBoxBrother()) {
      return '($count)';
    } else {
      var unLimited =
          item.children.where((f) => f.isSelected && f.isUnLimit()).toList();
      if (unLimited.isNotEmpty) {
        return '(全部)';
      }
    }
  }
  return itemCount;
}