getLength method
Implementation
@override
int getLength() {
int v = (customColumnType == null
? lengths[type][_col]
: columnTypeLength[customColumnType![_col]])!;
if (v == 0) {
int ye = yearEnd!;
if (maxValue != null) ye = maxValue!.year;
return ye - _yearBegin + 1;
}
if (v == 31) return _calcDateCount(value!.year, value!.month);
int _type = getColumnType(_col);
switch (_type) {
case 3: // hour
if ((minHour != null && minHour! >= 0) ||
(maxHour != null && maxHour! <= 23))
return (maxHour ?? 23) - (minHour ?? 0) + 1;
break;
case 4: // minute
if (minuteInterval != null && minuteInterval! > 1)
return v ~/ minuteInterval!;
break;
case 7: // hour am/pm
if ((minHour != null && minHour! >= 0) ||
(maxHour != null && maxHour! <= 23)) if (_colAP < 0) {
// I don't know AM or PM
return 12;
} else {
var _min = 0;
var _max = 0;
if (picker!.selecteds[_colAP] == 0) {
// am
_min = minHour == null
? 1
: minHour! >= 12
? 12
: minHour! + 1;
_max = maxHour == null
? 12
: maxHour! >= 12
? 12
: maxHour! + 1;
} else {
// pm
_min = minHour == null
? 1
: minHour! >= 12
? 24 - minHour! - 12
: 1;
_max = maxHour == null
? 12
: maxHour! >= 12
? maxHour! - 12
: 1;
}
return _max > _min ? _max - _min + 1 : _min - _max + 1;
}
break;
}
return v;
}