当下拉菜单被禁用时,它具有默认的黑色文本颜色,我想更改它。有更改图标颜色的选项,但没有更改文本颜色的选项。
任何帮助将不胜感激。
DropdownButtonFormField(
value: widget.selectedValue,
items: widget.dropdownItems,
dropdownColor: customTheme.colors.black30,
iconEnabledColor: customTheme.colors.textColor,
iconDisabledColor: Color.fromARGB(143, 144, 144, 144),
最佳答案
更改应用主题的属性 disabledColor
或使用 Theme
小部件:
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),
),
),
https://stackoverflow.com/questions/72050800/