我已经在我的项目中创建了这个弹出菜单,我正在尝试更改弹出菜单的背景颜色,但不确定如何更改它,所以如果我能得到任何帮助,我将不胜感激或建议。
? PopupMenuButton(
icon: Icon(
Icons.more_vert,
color: Colors.white,
),
onSelected: selectedOption,
itemBuilder: (BuildContext context) {
return Popup.choises.map((String value) {
return PopupMenuItem<String>(
value: value,
child: Text(value),
);
}).toList();
})
答案 0 :(得分:1)
只需将颜色参数提供给 PopupMenuButton 即可。
///example
PopupMenuButton(
color:Colors.red,
/// other parameters/options
)
答案 1 :(得分:1)
使用这个
PopupMenuButton(
color: Colors.white,
icon: Icon(
Icons.more_vert,
color: Colors.white,
),
onSelected: selectedOption,
itemBuilder: (BuildContext context) {
return Popup.choises.map((String value) {
return PopupMenuItem<String>(
value: value,
child: Text(value),
);
}).toList();
})