如何在 flutter 中更改弹出窗口背景颜色
How to change popup background color in flutter
我在我的项目中创建了这个弹出菜单,我正在尝试更改弹出菜单的背景颜色,但不确定如何更改它,所以如果我能得到任何东西,我将不胜感激帮助或建议。
? 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();
})
只需将颜色参数提供给 PopupMenuButton 即可。
///example
PopupMenuButton(
color:Colors.red,
/// other parameters/options
)
使用这个
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();
})
我在我的项目中创建了这个弹出菜单,我正在尝试更改弹出菜单的背景颜色,但不确定如何更改它,所以如果我能得到任何东西,我将不胜感激帮助或建议。
? 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();
})
只需将颜色参数提供给 PopupMenuButton 即可。
///example
PopupMenuButton(
color:Colors.red,
/// other parameters/options
)
使用这个
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();
})