From 8a8bf937eaceef106a9b4f493b82820c24177608 Mon Sep 17 00:00:00 2001 From: Strycher Date: Fri, 25 Sep 2026 03:24:17 -0400 Subject: [PATCH] fix(#713): short-sync banner no longer blanks the app window The banner sits in MaterialApp.builder, above the Navigator, where there is no Overlay. Its close IconButton had a tooltip, and a Tooltip without an Overlay throws ("No Overlay widget found"). In the owner's release build that painted the window gray the moment the pointer reached the button. The close button drops the tooltip and keeps the accessible "Close" label on the icon. New tests mount the banner in MaterialApp.builder, as the app does, and hover the close button; both failed before the fix with the Overlay error and pass now. The earlier tests mounted it under home:, which has an Overlay, so they could not catch this. Epic #668. Co-Authored-By: Claude Opus 5.5 --- .../contact_sync_shortfall_banner.dart | 9 +++- .../contact_sync_shortfall_banner_test.dart | 45 +++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/widgets/contact_sync_shortfall_banner.dart b/lib/widgets/contact_sync_shortfall_banner.dart index 708cdb88..5deb5958 100644 --- a/lib/widgets/contact_sync_shortfall_banner.dart +++ b/lib/widgets/contact_sync_shortfall_banner.dart @@ -92,9 +92,14 @@ class ContactSyncShortfallBanner extends StatelessWidget { ], ), ), + // No tooltip: this sits above the Navigator, where there is no + // Overlay, and a Tooltip without one blanks the window (#713). IconButton( - tooltip: l10n.common_close, - icon: Icon(Icons.close, color: scheme.onErrorContainer), + icon: Icon( + Icons.close, + color: scheme.onErrorContainer, + semanticLabel: l10n.common_close, + ), onPressed: onDismiss, ), ], diff --git a/test/widgets/contact_sync_shortfall_banner_test.dart b/test/widgets/contact_sync_shortfall_banner_test.dart index 3717fd65..ddf747b6 100644 --- a/test/widgets/contact_sync_shortfall_banner_test.dart +++ b/test/widgets/contact_sync_shortfall_banner_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -80,6 +81,50 @@ void main() { expect(calls, ['dismiss']); }); + // #713: the app mounts the banner in MaterialApp.builder, above the + // Navigator, where there is no Overlay. The tests above mount it under + // `home:`, which has one, so they could not see this. + group('mounted where the app mounts it (MaterialApp.builder)', () { + Widget inBuilder({bool decisionPending = false}) => MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + builder: (context, child) => ContactSyncShortfallBanner( + shortfall: short, + decisionPending: decisionPending, + undeliveredCount: 244, + onDismiss: () => calls.add('dismiss'), + onKeep: () => calls.add('keep'), + onUseRadio: () => calls.add('useRadio'), + child: child ?? const SizedBox.shrink(), + ), + home: const Scaffold(body: Text('APP')), + ); + + testWidgets('hovering the close button does not break the app', ( + tester, + ) async { + await tester.pumpWidget(inBuilder()); + final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + await gesture.addPointer(location: Offset.zero); + addTearDown(gesture.removePointer); + await gesture.moveTo(tester.getCenter(find.byIcon(Icons.close))); + await tester.pumpAndSettle(const Duration(seconds: 2)); + + expect(tester.takeException(), isNull); + expect(find.text('Contact sync incomplete'), findsOneWidget); + expect(find.text('APP'), findsOneWidget); + }); + + testWidgets('the decision dialog works there too', (tester) async { + await tester.pumpWidget(inBuilder(decisionPending: true)); + await tester.pump(); + await tester.tap(find.text('Keep my contacts')); + + expect(tester.takeException(), isNull); + expect(calls, ['keep']); + }); + }); + group('decision pending', () { testWidgets('asks, says how many would be removed, defaults to Keep', ( tester,