Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have this error #31

Open
ninjai001 opened this issue Nov 29, 2020 · 1 comment
Open

I have this error #31

ninjai001 opened this issue Nov 29, 2020 · 1 comment

Comments

@ninjai001
Copy link

package:flutter/src/widgets/media_query.dart': Failed assertion: line 819 pos 12: 'context != null': is not true
c

@function1983
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants