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!;
      if (_colAP >= 0) {
        h =  _calcHourOfAMPM(h, m);
      }
      break;
    case 5:
      s = index;
      break;
    case 6:
      h = _calcHourOfAMPM(h, m);
      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) {
        h = _calcHourOfAMPM(h, m);
      }
      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);
  }
}