getSelectedItemCount method

String getSelectedItemCount(
  1. TSelectionEntity item
)

Implementation

String getSelectedItemCount(TSelectionEntity 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;
}