dropdown_button2
dropdown_button2 copied to clipboard
Using DropdownButton2 above the Navigator
Hi, I'm trying to use the DropdownButton2 in some global main menu inside builder() method of MaterialApp, therefore it's located under the MaterialApp but above the Navigator, so is unable to find the Navigator inside context and crashes.
Before switching to DropdownButton2 I used a regular Material showMenu() that allowed me to get the GoRouter instance with Riverpod, and use its navigatorKey to obtain the correct Navigator context and pass it as context param, like this:
showMenu<int>(context: router.configuration.navigatorKey.currentContext ?? context, ...);
Please consider adding a possibility to override the context in some similar way.