首页 > 解决方案 > 如何在颤动中更改弹出背景颜色

问题描述

我已经在我的项目中创建了这个弹出菜单,我正在尝试更改弹出菜单的背景颜色,但我不确定如何更改它,所以如果我能得到任何帮助或建议,我将不胜感激。

                      ? 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();
                          })

在此处输入图像描述

标签: flutterdartflutter-layoutflutter-webflutter-animation

解决方案


Just provide the color parameter to PopupMenuButton and it will work.

///example
PopupMenuButton(
color:Colors.red,
/// other parameters/options
)

推荐阅读