fix: construct banner always does cleanup on close (#3573)

This commit is contained in:
avashilling 2025-07-29 09:12:40 -04:00 committed by GitHub
parent 15d3eb9cd7
commit 63c77b067a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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() {