3

When the dropdown is disabled it has this default black text color, which I want to change. There is an option to change the icon color but no option for text color.
Any help would be greatly appreciated.

DropdownButtonFormField(
        value: widget.selectedValue,
        items: widget.dropdownItems,
        dropdownColor: customTheme.colors.black30,
        iconEnabledColor: customTheme.colors.textColor,
        iconDisabledColor: Color.fromARGB(143, 144, 144, 144),
Mahan Marwat
  • 373
  • 1
  • 13

2 Answers2

1

Change the property disabledColor of your app theme or use Theme widget:

Theme(
        data: Theme.of(context).copyWith(disabledColor: customTheme.colors.black30),
        child: DropdownButtonFormField(
            value: widget.selectedValue,
            items: widget.dropdownItems,
            dropdownColor: customTheme.colors.black30,
            iconEnabledColor: customTheme.colors.textColor,
            iconDisabledColor: Color.fromARGB(143, 144, 144, 144),
        ),
),
-2

You can change using style

style: const TextStyle(
       color: Colors.pink,
       backgroundColor: Colors.grey,
),

Here you can find more: https://www.flutter-code.com/2021/06/flutter-dropdownbutton-selected-text.html

Jasmin Sojitra
  • 1,090
  • 10
  • 24