How to change popup background color in flutter

Viewed 827

I've created this popup menu in my project and I'm trying to change the the background color of the popup menu but not really sure how I ca change it so I would be really appreciated if I can get any help or suggestion.

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

enter image description here

2 Answers

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

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

Use this

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