doShow method
Implementation
@override
void doShow() {
if (_yearBegin == 0) getLength();
var _maxLevel = getMaxLevel();
final sh = value!.hour;
for (int i = 0; i < _maxLevel; i++) {
int colType = getColumnType(i);
switch (colType) {
case 0:
picker!.selecteds[i] = yearEnd != null && value!.year > yearEnd!
? yearEnd! - _yearBegin
: value!.year - _yearBegin;
break;
case 1:
picker!.selecteds[i] = value!.month - 1;
break;
case 2:
picker!.selecteds[i] = value!.day - 1;
break;
case 3:
var h = sh;
if ((minHour != null && minHour! >= 0) ||
(maxHour != null && maxHour! <= 23)) {
if (minHour != null) {
h = h > minHour! ? h - minHour! : 0;
} else {
h = (maxHour ?? 23) - (minHour ?? 0) + 1;
}
}
picker!.selecteds[i] = h;
break;
case 4:
// minute
if (minuteInterval == null || minuteInterval! < 2) {
picker!.selecteds[i] = value!.minute;
} else {
picker!.selecteds[i] = value!.minute ~/ minuteInterval!;
final m = picker!.selecteds[i] * minuteInterval!;
if (m != value!.minute) {
// 需要更新 value
var s = value!.second;
if (type != 2 && type != 6) s = 0;
final h = _colAP >= 0 ? _calcHourOfAMPM(sh, m) : sh;
value = DateTime(value!.year, value!.month, value!.day, h, m, s);
}
}
break;
case 5:
picker!.selecteds[i] = value!.second;
break;
case 6:
// am/pm
picker!.selecteds[i] = (sh > 12 ||
(sh == 12 && (value!.minute > 0 || value!.second > 0)))
? 1
: 0;
break;
case 7:
picker!.selecteds[i] = sh == 0
? 11
: (sh > 12)
? sh - 12 - 1
: sh - 1;
break;
}
}
}