processBrotherItemSelectStatus static method

void processBrotherItemSelectStatus(
  1. SelectionEntity selectionEntity
)

处理兄弟结点为未选中状态,将自己置为选中状态

Implementation

static void processBrotherItemSelectStatus(SelectionEntity selectionEntity) {
  if (SelectionFilterType.checkbox == selectionEntity.filterType) {
    selectionEntity.isSelected = !selectionEntity.isSelected;
    List<SelectionEntity>? allBrothers = selectionEntity.parent?.children;
    if (!PhoenixTools.isEmpty(allBrothers)) {
      for (SelectionEntity entity in allBrothers!) {
        if (entity != selectionEntity) {
          if (entity.filterType == SelectionFilterType.radio) {
            entity.isSelected = false;
          }

          if (entity.filterType == SelectionFilterType.date) {
            entity.isSelected = false;
            entity.value = null;
          }
        }
      }
    }
  }
  if (SelectionFilterType.radio == selectionEntity.filterType) {
    selectionEntity.parent?.clearChildSelection();
    selectionEntity.isSelected = true;
  }

  if (SelectionFilterType.date == selectionEntity.filterType) {
    selectionEntity.parent?.clearChildSelection();

    /// 日期类型时在外部 Picker 点击确定时设置 选中状态
    selectionEntity.isSelected = true;
  }
}