getExtendUI method

Widget getExtendUI(
  1. LevelsBaseModel item
)

Implementation

Widget getExtendUI(LevelsBaseModel item) {
  late Widget extendItem;
  switch (levelExtendsUI) {
    case ShowPickExtendsUI.extendsNone:
      extendItem = Text('');
      break;
    case ShowPickExtendsUI.extendsLabel:
      extendItem = extendLabel ??
          Text(
            placeHolderText,
            style: TextStyle(color: Colors.blue, fontSize: 14),
          );
      break;
    case ShowPickExtendsUI.extendsIcon:
      {
        extendItem = IconButton(
            onPressed: () {
              if (_preCacheModel == item) {
                item.setSelected(!item.selected);
              } else {
                if (_preCacheModel != null) {
                  _preCacheModel?.setSelected(false);
                }
                item.setSelected(!item.selected);
                if (item.selected) {
                  _preCacheModel = item;
                }
              }
              callBack?.call(item, this);
            },
            icon: Image.asset(
              item.selected ? 'system_radio_sel.png' : 'system_radio_nor.png',
              package: 'flutter_levels_picker',
            ));
      }
      break;
    default:
  }
  return extendItem;
}