fix: construct banner always does cleanup on close (#3573)
This commit is contained in:
parent
15d3eb9cd7
commit
63c77b067a
1 changed files with 12 additions and 4 deletions
|
|
@ -32,12 +32,14 @@ class ConstructNotificationUtil {
|
|||
}
|
||||
}
|
||||
|
||||
static final Set<String> _closedOverlays = {};
|
||||
|
||||
static void onClose(ConstructIdentifier construct) {
|
||||
final overlayKey = "${construct.string}_snackbar";
|
||||
if (_closedOverlays.contains(overlayKey)) return;
|
||||
_closedOverlays.add(overlayKey);
|
||||
MatrixState.pAnyState.closeOverlay(overlayKey);
|
||||
|
||||
MatrixState.pAnyState.activeOverlays.remove(overlayKey);
|
||||
|
||||
unlockedConstructs.remove(construct);
|
||||
closeCompleter?.complete();
|
||||
closeCompleter = null;
|
||||
|
|
@ -147,14 +149,20 @@ class ConstructNotificationOverlayState
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
ConstructNotificationUtil.onClose(widget.construct);
|
||||
_controller?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _close() {
|
||||
_controller?.reverse().then((_) {
|
||||
if (_controller?.status == AnimationStatus.completed) {
|
||||
//only animate closed if still mounted, not if navigating away
|
||||
_controller?.reverse().then((_) {
|
||||
ConstructNotificationUtil.onClose(widget.construct);
|
||||
});
|
||||
} else {
|
||||
ConstructNotificationUtil.onClose(widget.construct);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _showDetails() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue