From dc4ce90bf292f6e921c81ffe20f3a34ba72373c5 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:23:11 -0500 Subject: [PATCH] fix: add guard to prevent showing screen size popup when expanding screen after showing popup (#5127) --- lib/widgets/matrix.dart | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index e2f18d870..ef3a4b537 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -299,6 +299,7 @@ class MatrixState extends State with WidgetsBindingObserver { // #Pangea bool _showingScreenSizeDialog = false; + double? _lastShownPopupHeight; @override void didChangeMetrics() { _showScreenSizeDialog(); @@ -306,19 +307,29 @@ class MatrixState extends State with WidgetsBindingObserver { } Future _showScreenSizeDialog() async { - if (_showingScreenSizeDialog || - !kIsWeb || - MediaQuery.heightOf(context) > 500) { + if (_showingScreenSizeDialog || !kIsWeb) { + return; + } + + final height = MediaQuery.heightOf(context); + if (height > 500) { + _lastShownPopupHeight = null; + return; + } + + if (_lastShownPopupHeight != null && height >= _lastShownPopupHeight!) { return; } _showingScreenSizeDialog = true; + _lastShownPopupHeight = height; await showOkAlertDialog( context: FluffyChatApp.router.routerDelegate.navigatorKey.currentContext ?? context, title: L10n.of(context).screenSizeWarning, ); + _lastShownPopupHeight = MediaQuery.heightOf(context); _showingScreenSizeDialog = false; }