doSelect method

  1. @override
void doSelect(
  1. int column,
  2. int index
)
override

Implementation

@override
void doSelect(int column, int index) {
  int year, month, day, h, m, s;
  year = value!.year;
  month = value!.month;
  day = value!.day;
  h = value!.hour;
  m = value!.minute;
  s = _existSec ? value!.second : 0;

  int colType = getColumnType(column);
  switch (colType) {
    case 0:
      year = _yearBegin + index;
      break;
    case 1:
      month = index + 1;
      break;
    case 2:
      day = index + 1;
      break;
    case 3:
      h = index + (minHour ?? 0);
      break;
    case 4:
      m = (minuteInterval == null || minuteInterval! < 2)
          ? index
          : index * minuteInterval!;
      break;
    case 5:
      s = index;
      break;
    case 6:
      if (picker!.selecteds[_colAP] == 0) {
        if (h == 0) h = 12;
        if (h > 12) h = h - 12;
      } else {
        if (h < 12) h = h + 12;
        if (h == 12) h = 0;
      }
      if (minHour != null || maxHour != null) {
        if (minHour != null && _colHour >= 0) {
          if (h < minHour!) {
            picker!.selecteds[_colHour] = 0;
            picker!.updateColumn(_colHour);
            return;
          }
        }
        if (maxHour != null && h > maxHour!) h = maxHour!;
      }
      break;
    case 7:
      h = index +
          (minHour == null
              ? 0
              : (picker!.selecteds[_colAP] == 0 ? minHour! : 0)) +
          1;
      if (_colAP >= 0 && picker!.selecteds[_colAP] == 1) h = h + 12;
      if (h > 23) h = 0;
      break;
  }
  int __day = _calcDateCount(year, month);

  bool _isChangeDay = false;
  if (day > __day) {
    day = __day;
    _isChangeDay = true;
  }
  value = DateTime(year, month, day, h, m, s);

  if (_verificationMinMaxValue()) {
    notifyDataChanged();
  } else if (_isChangeDay && _colDay >= 0) {
    doShow();
    picker!.updateColumn(_colDay);
  }
}