'How do I get an overlay to appear on a button click and then that button stay above the overlay in flutter?

I'm developing an app and I want the button I click on to activate a total screen overlay. Basically turn the screen darker whilst keeping the button I've clicked above this overlay. Ive managed to hack my way through it by putting a container with a black opacity in a stack with the button and then have it show on click but it doesn't fully over the screen because of the space the bottom navigation bar takes. Any ideas?

enter image description here



Solution 1:[1]

I figured out a hacky way of doing it. I put the controller.currentPage and the bottom nav bar into a stack with a container with Colors.black.withOpacity(0.5). then just triggered in on click. kinda works but its hacky.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1