rebuildSelected method

void rebuildSelected()

Implementation

void rebuildSelected(){
  selectedWidget = [];
  for(int i = 0; i < selectedItems.length; i++){
    PhotoInfo p = selectedItems[i];
    selectedWidget.add(Chip(
      avatar: Container(
        padding: EdgeInsets.only(left: 5), child: Icon(p.icon, size: 22, color: MyColors.grey_60),
      ),
      label: Container(
          padding: EdgeInsets.only(top: 6), height: 28, child: Text(p.title!, style: TextStyle(color: MyColors.grey_80))
      ),
      deleteIcon: Icon(Icons.cancel, size: 20),
      deleteIconColor: Colors.grey,
      onDeleted: (){
        selectedItems.removeAt(i);
        rebuildSelected();
        selectedLength.value = selectedItems.length;
      },
    ));
  }

  selectedWidget.add(Container(width: 100,
    child: TextField(controller: inputController,
      decoration: InputDecoration(
        hintStyle:TextStyle(color: MyColors.grey_40, fontSize: 15),
        border: InputBorder.none, hintText: "Search Info..."
      ),
      onChanged: (value){
        adapter.filter(value);
      },
    ),
  ));
}