Theme的canvasColor属性可以修改下拉栏背景色
List<String> _demoList = ['one', 'two'];
// 外层Theme的canvasColor属性可以修改下拉栏背景色
Theme(
data: Theme.of(context).copyWith(
canvasColor: Color.fromRGBO(27, 29, 67, 1.00),
),
// DropdownButtonHideUnderline 没有下划线的下拉栏
child: DropdownButtonHideUnderline(
child: DropdownButton(
style: TextStyle(color: Color.fromRGBO(0, 255, 255, 1.00),),
items: _demoList.map((value) {
return DropdownMenuItem(
child: Text(value),
value: value,
);
}).toList(),
value: _demoList,
onChanged: (String value) {
setState(() {
_demoList = value;
});
},
)))
网友评论