How to change the DropdownButton's icon color? Flutter

Korenz picture Korenz · Dec 25, 2018 · Viewed 9.8k times · Source

In Flutter, I am trying to change the color of the DropdownButton's icon (the down arrow icon) to white color.

I tried using the style property with no help. The text color became white but the icon is still the default grey.

DropdownButton(
         style: TextStyle(color: Colors.white, decorationColor: 
             Colors.white),
         items: this.items,
         value: null,
         hint: Text(SaveOptions[_saveOption], style: TextStyle(color: 
             Colors.white)),
         onChanged: (selectedOption) {
           setState(() {
             _saveOption = selectedOption;
           });
         })

How do I change the color of the arrow icon to white?

Answer

AlvaroSantisteban picture AlvaroSantisteban · Jun 13, 2019

You can use the fields iconEnabledColor and iconDisabledColor in the following manner:

final myDropDownMenu = DropdownButton<String>(
      iconEnabledColor: Colors.white,
      iconDisabledColor: Colors.white,
      value: myInitialValue,
      // The rest of your code
);