From 1949c22b8533e375fc76f2bd8e018588b404c760 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:32:13 +0200 Subject: [PATCH] fix(trackers): dialog cancel pops screen behind --- lib/screens/settings/tracker_connect_launcher.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/screens/settings/tracker_connect_launcher.dart b/lib/screens/settings/tracker_connect_launcher.dart index 703ae1aa..0bf3e0b5 100644 --- a/lib/screens/settings/tracker_connect_launcher.dart +++ b/lib/screens/settings/tracker_connect_launcher.dart @@ -36,7 +36,12 @@ Future launchTrackerConnect( showDialog( context: context, barrierDismissible: false, - builder: (_) => buildDialog(payload, onCancel), + builder: (_) => buildDialog(payload, () { + // Flip synchronously so the post-await guard below is a no-op — + // `whenComplete` fires a microtask later and loses the race otherwise. + dialogOpen = false; + onCancel(); + }), ).whenComplete(() => dialogOpen = false); if (autoLaunchBrowser) { unawaited(