[英]How to Change the splash color when tapping DropdownButton In flutter?
在 flutter 的DropdownButton
小部件中,我想在点击时更改启动颜色。 虽然我改变了DropdownButton
的focusColor
但没有任何改变......如何做到这一点???
Container(
height: 20,
padding: EdgeInsets.only(
right: 10,
left: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(38),
border: Border.all(
color: Color(0xFFEAD6EE),
)),
child: DropdownButton(
focusColor: Color(0xFFC88FFF),
style: TextStyle(
fontSize: 16,
color: fontColor.withOpacity(0.5),
fontWeight: FontWeight.normal,
),
isExpanded: true,
hint: Text('$editedCountry'),
items: dropdownMenuItemByCategory('Country'),
onChanged: (editedIndValue) {
_onCountrySelected(editedIndValue);
},
value: editedCountryID,
underline: SizedBox(),
),
),
用Theme
包装你的DropdownButton
Theme(
data: ThemeData(
splashColor: Colors.red, //change based your need
),
child: DropdownButton(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.