Fix exception when enabling widget-selection mode in Widget Inspector when popover is open #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Visual Studio Code's Widget Inspector causes 'PopoverItem' to throw an exception when trying to recalculate the bounds of the injected 'BuildContext', because the context has been unmounted possibly due to the popover being open and the currently active route. For whatever reason, the widget is mounted when 'didChangeDependencies' is called, but not in the post-frame callback that tries to use the deactivated context.
This pull request prevents the exception from being thrown when enabling widget selection mode in VSCode's Widget Inspector while the popover is open.
This is the issue that is fixed.
Here is a video of the exception before and after it's fixed.
https://user-images.githubusercontent.com/3419440/221905336-380560e0-774c-4274-84e7-4ad131d02995.mp4
I will note that I cannot replicate the issue on the example app included with this library.