doShow method
Implementation
@override
void doShow() {
if (_yearBegin == 0) getLength();
var _maxLevel = getMaxLevel();
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 = value!.hour;
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:
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;
value = DateTime(
value!.year, value!.month, value!.day, value!.hour, m, s);
}
}
break;
case 5:
picker!.selecteds[i] = value!.second;
break;
case 6:
picker!.selecteds[i] = (value!.hour > 12 || value!.hour == 0) ? 1 : 0;
break;
case 7:
picker!.selecteds[i] = value!.hour == 0
? 11
: (value!.hour > 12)
? value!.hour - 12 - 1
: value!.hour - 1;
break;
}
}
}