all popups/dialog initiated using a widget W's context should be disposed automatically when the W
is disposed
#58953
Labels
c: proposal
A detailed proposal for a change to Flutter
f: material design
flutter/packages/flutter/material repository.
framework
flutter/packages/flutter repository. See also f: labels.
team-design
Owned by Design Languages team
triaged-design
Triaged by Design Languages team
Use case
I am working on a flutter app that requires two separate widgets to be displayed on a specific orientation. To achieve that I have used an orientation builder widget and it works fine.
Both widgets are not interconnected at all and both have their own set of Option Menu Items [ in simple words 3-dots menu in android] and context menu items [displayed on long press].
What happens is when I change orientation while keeping Option Menu or Context Menu Open in flutter app, it manages to be live even when the underlying widget is disposed and replaced by another widget.
Let's call the currently visible widget as
root
widget.I need to close these popups and dialogs that have been displayed using
root
's context.I have also posted the same on stackoverflow.
I got an answer, which turns out to be working, but as a side effect, along with the dialog & popups that code also disposes of any screens that I have navigated to from the
root
.That is because the answer code relies on rebuilds of a widget which can happen at any time even if the widget is in the background.
So, Basically what I want to do is close all popups and dialogs on dispose of the
root
.This description might feel a bit abstract, so if more details are required just ask me. I will update more details in the future if I am able to find a way to express the same via app code or screenshots
Proposal
flutter should be able to remove all popup/dialogs rendered using the
root
's context onroot
gets disposed of.I think The real problem is identifying only dialog/popup elements from the tree and removing them.
The text was updated successfully, but these errors were encountered: