score:0

Accepted answer

you need to wrap your widget that opens up the menu in a builder and have theme as the parent of this builder. here is the code that will get you going.

@override
widget build(buildcontext context) {
  return theme(
    data: theme.of(context).copywith(
      cardcolor: colors.white,
      texttheme: theme.of(context).texttheme.apply(bodycolor: colors.black),
    ),
    child: builder(
      builder: (context) {
        return raisedbutton(
          child: text("show menu"),
          onpressed: () {
            showmenu(
              context: context,
              position: relativerect.fromltrb(0, 100, 0, 0),
              items: [
                popupmenuitem(child: text("item 0"), value: 0),
                popupmenuitem(child: text("item 1"), value: 1),
                popupmenuitem(child: text("item 2"), value: 2),
              ],
            );
          },
        );
      },
    ),
  );
}

enter image description here


Related Query

More Query from same tag