buildItem method
Implementation
@override
Widget buildItem(BuildContext context, int index) {
String _text = "";
int colType = getColumnType(_col);
switch (colType) {
case 0:
if (twoDigitYear) {
_text = "${_yearBegin + index}";
var _l = _text.length;
_text =
"${_text.substring(_l - (_l - 2), _l)}${_checkStr(yearSuffix)}";
} else
_text = "${_yearBegin + index}${_checkStr(yearSuffix)}";
break;
case 1:
if (isNumberMonth) {
_text = "${index + 1}${_checkStr(monthSuffix)}";
} else {
if (months != null)
_text = "${months![index]}";
else {
List _months =
PickerLocalizations.of(context).months ?? MonthsList_EN;
_text = "${_months[index]}";
}
}
break;
case 2:
_text = "${index + 1}${_checkStr(daySuffix)}";
break;
case 3:
_text = "${intToStr(index + (minHour ?? 0))}${_checkStr(hourSuffix)}";
break;
case 5:
_text = "${intToStr(index)}${_checkStr(secondSuffix)}";
break;
case 4:
if (minuteInterval == null || minuteInterval! < 2)
_text = "${intToStr(index)}${_checkStr(minuteSuffix)}";
else
_text =
"${intToStr(index * minuteInterval!)}${_checkStr(minuteSuffix)}";
break;
case 6:
List? _ampm = strAMPM ?? PickerLocalizations.of(context).ampm;
if (_ampm == null) _ampm = const ['AM', 'PM'];
_text = "${_ampm[index]}";
break;
case 7:
_text =
"${intToStr(index + (minHour == null ? 0 : (picker!.selecteds[_colAP] == 0 ? minHour! : 0)) + 1)}";
break;
}
final isSel = picker!.selecteds[_col] == index;
if (picker!.onBuilderItem != null) {
var _v = picker!.onBuilderItem!(context, _text, null, isSel, _col, index);
if (_v != null) return _v;
}
return makeText(null, _text, isSel);
}