Home > Net >  Remove suffix icon from DropdownSearch in flutter
Remove suffix icon from DropdownSearch in flutter

Time:07-07

I want to remove suffix icon from DropdownSearch widget. I am using dropdown_search plugin. I have tried giving size to icon and also added visibility false. but any of these didn't work. Even I have tried using dropdown builder too..!!

Please help..!!

DropdownSearch<String>(
      dropdownBuilder: (context, str) {
        return Text(str ?? "-");
      },
      dropdownDecoratorProps: DropDownDecoratorProps(
          textAlign: TextAlign.left,
          textAlignVertical: TextAlignVertical.center,
          dropdownSearchDecoration: _appTheme.dropDownDecoration()),
      dropdownButtonProps: const DropdownButtonProps(
          alignment: Alignment.centerRight,
          padding: EdgeInsets.all(0),
          icon: SizedBox(
            width: 0,
            child: Visibility(
                visible: false,
                child: Icon(
                  Icons.arrow_downward,
                  size: 0,
                )),
          ),
          isVisible: false,
          constraints: BoxConstraints(maxWidth: 0, maxHeight: 0),
          iconSize: 0),
      popupProps: PopupProps.menu(
        textStyle: _appTheme.textFiledStyle,
        showSelectedItems: true,
        showSearchBox: true,
      ),
      items: _registrationBloc.countries,
      onChanged: (value) {
        _registrationBloc.selectedCountry = value;
      },
      selectedItem: _registrationBloc.selectedCountry,
    )

CodePudding user response:

set the isVisible property to false it will work. or you can use other plugin. one is searchfield which i have used.

CodePudding user response:

There is a 'dropDownButton' property for DropdownSearch, use it as follows

dropDownButton : Container(),

hope it works

  • Related