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?
Since the DropdownButton
gets the color from the nearest Theme
, you have two options.
The first one is by changing the brightness of the application theme.
And the other is by wrapping your dropdown
button with a new Theme
with dark brightness
.
Theme(
data: Theme.of(context).copyWith(brightness: Brightness.dark),
child: 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;
});
},
),
)