buildItem method

  1. @override
Widget buildItem(
  1. BuildContext context,
  2. int index
)
override

Implementation

@override
Widget buildItem(BuildContext context, int index) {
  final PickerItem item = _datas![index];
  final isSel = index == picker!.selecteds[_col];
  if (picker!.onBuilderItem != null) {
    final _v = picker!.onBuilderItem!(
        context, item.value.toString(), item.text, isSel, _col, index);
    if (_v != null) return makeText(_v, null, isSel);
  }
  if (item.text != null) {
    return isSel && picker!.selectedTextStyle != null
        ? DefaultTextStyle(
            style: picker!.selectedTextStyle!,
            textAlign: picker!.textAlign,
            child: picker!.selectedIconTheme != null
                ? IconTheme(
                    data: picker!.selectedIconTheme!,
                    child: item.text!,
                  )
                : item.text!)
        : item.text!;
  }
  return makeText(
      item.text, item.text != null ? null : item.value.toString(), isSel);
}