multi_select_flutter icon indicating copy to clipboard operation
multi_select_flutter copied to clipboard

MultiSelectChipDisplay : custom icon doesn't replace default icon(Icons.checked).

Open director2010s opened this issue 2 years ago • 5 comments

Please check screenshot for my UI. https://prnt.sc/nEmSOC_ZxUgg

remove icon and checked icon is overlapped. checked icon should be removed, but it is still existing with remove icon together.

MultiSelectChipDisplay( items: provider.arrSavedPromoters.map((e) => MultiSelectItem<Promoter>(e, e.username)).toList(), icon: const Icon( Icons.highlight_remove, color: Colors.red,), // icon: const Icon( Icons.check, color: Colors.red,), chipColor: Colors.green, textStyle: const TextStyle(color: Colors.black), onTap: (item) { provider.onRemoveAddedPromoter(item.paymail); },),

director2010s avatar Aug 29 '23 13:08 director2010s

I have the same problem as Razvan (director2010s) have. I can't use a custom Icon for MultiSelectChipDisplay. Did anyone found a solution for this bug ? I'm thinking to clone the multi_select_flutter library -> after to change the icon in the cloned location and later on to link the local library into Pubspec file just to fix this issue.

florentin89 avatar Jan 04 '24 12:01 florentin89

you can add value (showCheckmark: false) at ChoiceChip in MultiSelectChipDisplay

alex-dh-kim avatar Jan 11 '24 00:01 alex-dh-kim

you can add value (showCheckmark: false) at ChoiceChip in MultiSelectChipDisplay

Hi @alex-dh-kim , I can't find anywhere that option. Can you guide me please how to access that showCheckmark option ? I have the latest version of the plugin. Here is my code:

MultiSelectDialogField(
                      searchable: true,
                      initialValue: _selectedOptionsList,
                      items: _optionsList
                          .map((OptionModel option) =>
                              MultiSelectItem<OptionModel>(option, option.name ?? ""))
                          .toList(),
                      title: const Text("Select Option"),
                      selectedColor: Colors.blue,
                      decoration: const BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(40))),
                      buttonIcon: const Icon(Icons.checklist,color: Colors.blue),
                      buttonText: const Text("My Options",style: TextStyle(fontSize: 14)),
                      onConfirm: (selectedList) {
                        setState(() => _selectedOptionsList = selectedList.cast<OptionModel>()
                        );
                      },
                      chipDisplay: MultiSelectChipDisplay(
                        onTap: (selectedChip) {
                          setState(() => _selectedOptionsList.remove(selectedChip));
                          return _selectedOptionsList;
                        },
                      ),
                      itemsTextStyle: TextStyle(color: isDarkMode ? AppColors.contentColorWhite : AppColors.contentColorBlack),
                      selectedItemsTextStyle: TextStyle( color: isDarkMode ? AppColors.contentColorWhite : AppColors.contentColorBlack),
                      )

florentin89 avatar Jan 11 '24 13:01 florentin89

@florentin89 I mean, you can find ChoiceChip Widget in MultiSelectChipDisplay Widget.( you should find _buildItem function in MultiSelectChipDisplay (line 132) I'm using version 4.1.3 (multi_select_flutter: ^4.1.3) hope this helps

(multi_select_chip_display.dart)
  Widget _buildItem(MultiSelectItem<V> item, BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(2.0),
      child: ChoiceChip(
        shape: shape as OutlinedBorder?,
        showCheckmark: false, // <----- add this key:value
        avatar: icon != null
        ....

alex-dh-kim avatar Jan 11 '24 22:01 alex-dh-kim

For now you can just add

chipTheme: ChipThemeData(
        showCheckmark: false,
      ),

To your ThemeData in MaterialApp

JulianWijst avatar Mar 05 '24 12:03 JulianWijst