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 <noreply@anthropic.com>
feat/668-contact-sync-guard
Strycher 2 months ago committed by diffwireauto
parent d5008a746b
commit 8a8bf937ea

@ -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,
),
],

@ -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,

Loading…
Cancel
Save

Powered by TurnKey Linux.