[英]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.