Open ninjai001 opened 4 years ago
Try passing in BuildContext of the parent widget
GestureDetector(
key: btnKey,
onTap: () => customBackground(btnKey, context),
child: Container()
)
void customBackground(GlobalKey btnKey, BuildContext mainContext) {
menu.dismiss();
menu = PopupMenu(
context: mainContext,
items: [
MenuItem(
title: 'Mail',
image: Icon(
Icons.mail,
color: Colors.white,
)),
],
onClickMenu: onClickMenu,
stateChanged: stateChanged,
onDismiss: onDismiss);
menu.show(widgetKey: btnKey);
}
package:flutter/src/widgets/media_query.dart': Failed assertion: line 819 pos 12: 'context != null': is not true c