From 0059d44571794e0504c931c34920c613b96cc2c3 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 22 Nov 2026 19:20:38 +0100 Subject: [PATCH] Audit icons: add 1-word hover tooltips Todo: fe70b845 --- phone_app/lib/screens/free_days_screen.dart | 9 ++-- .../lib/screens/github_mirror_screen.dart | 51 ++++++++++-------- phone_app/lib/screens/home_body.dart | 54 +++++++++++-------- phone_app/lib/screens/home_screen.dart | 2 + phone_app/lib/screens/ring_stakes_line.dart | 10 +++- phone_app/lib/screens/settings_screen.dart | 32 ++++++----- phone_app/lib/screens/stakes_marks.dart | 44 ++++++++++----- .../test/services/sync_emulator_test.dart | 19 ++++--- phone_app/test/text_free_support.dart | 9 +++- phone_app/test/tooltips_test.dart | 32 +++++++++++ 10 files changed, 181 insertions(+), 81 deletions(-) create mode 100644 phone_app/test/tooltips_test.dart diff --git a/phone_app/lib/screens/free_days_screen.dart b/phone_app/lib/screens/free_days_screen.dart index 793a807..46c4080 100644 --- a/phone_app/lib/screens/free_days_screen.dart +++ b/phone_app/lib/screens/free_days_screen.dart @@ -176,9 +176,12 @@ class _FreeDaysScreenState extends State { appBar: AppBar( // title removed actions: [ - IconButton( - icon: const Icon(Icons.sync, semanticLabel: 'Sync now'), - onPressed: _busy ? null : () => unawaited(_sync()), + Tooltip( + message: 'Sync', + child: IconButton( + icon: const Icon(Icons.sync, semanticLabel: 'Sync now'), + onPressed: _busy ? null : () => unawaited(_sync()), + ), ), ], ), diff --git a/phone_app/lib/screens/github_mirror_screen.dart b/phone_app/lib/screens/github_mirror_screen.dart index a730e5b..7be36e3 100644 --- a/phone_app/lib/screens/github_mirror_screen.dart +++ b/phone_app/lib/screens/github_mirror_screen.dart @@ -94,33 +94,42 @@ class _GitHubMirrorScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Icon( - isConnected ? Icons.link : Icons.link_off, - color: isConnected - ? Theme.of(context).colorScheme.tertiary - : Theme.of(context).colorScheme.onSurfaceVariant, - size: 32, - semanticLabel: isConnected - ? 'Connected to GitHub.' - : 'Not connected to GitHub.', + Tooltip( + message: isConnected ? 'Connected' : 'Disconnected', + child: Icon( + isConnected ? Icons.link : Icons.link_off, + color: isConnected + ? Theme.of(context).colorScheme.tertiary + : Theme.of(context).colorScheme.onSurfaceVariant, + size: 32, + semanticLabel: isConnected + ? 'Connected to GitHub.' + : 'Not connected to GitHub.', + ), ), const SizedBox(height: 12), if (!isConnected) - ElevatedButton( - key: const ValueKey('github-connect'), - onPressed: _busy ? null : _connectGitHub, - child: const Icon( - Icons.link, - semanticLabel: 'Connect GitHub', + Tooltip( + message: 'Connect', + child: ElevatedButton( + key: const ValueKey('github-connect'), + onPressed: _busy ? null : _connectGitHub, + child: const Icon( + Icons.link, + semanticLabel: 'Connect GitHub', + ), ), ) else - OutlinedButton( - key: const ValueKey('github-disconnect'), - onPressed: _busy ? null : _disconnect, - child: const Icon( - Icons.link_off, - semanticLabel: 'Disconnect GitHub', + Tooltip( + message: 'Disconnect', + child: OutlinedButton( + key: const ValueKey('github-disconnect'), + onPressed: _busy ? null : _disconnect, + child: const Icon( + Icons.link_off, + semanticLabel: 'Disconnect GitHub', + ), ), ), const SizedBox(height: 16), diff --git a/phone_app/lib/screens/home_body.dart b/phone_app/lib/screens/home_body.dart index acb935f..fce078c 100644 --- a/phone_app/lib/screens/home_body.dart +++ b/phone_app/lib/screens/home_body.dart @@ -77,11 +77,14 @@ class HomeBody extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons.alarm_on, - size: 32, - color: theme.colorScheme.primary, - semanticLabel: 'Alarm is armed for', + Tooltip( + message: 'Armed', + child: Icon( + Icons.alarm_on, + size: 32, + color: theme.colorScheme.primary, + semanticLabel: 'Alarm is armed for', + ), ), HomePresenceLine(key: ValueKey(syncEpoch)), const SizedBox(height: 16), @@ -96,22 +99,28 @@ class HomeBody extends StatelessWidget { Row( mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons.restore, - size: 18, - semanticLabel: - 'One-shot early start, back to $baseline ' - 'after it rings', + Tooltip( + message: 'Oneshot', + child: Icon( + Icons.restore, + size: 18, + semanticLabel: + 'One-shot early start, back to $baseline ' + 'after it rings', + ), ), Text(baseline), ], ) else - Icon( - Icons.all_inclusive, - size: 18, - color: theme.colorScheme.onSurfaceVariant, - semanticLabel: 'Every day. It cannot be turned off.', + Tooltip( + message: 'Daily', + child: Icon( + Icons.all_inclusive, + size: 18, + color: theme.colorScheme.onSurfaceVariant, + semanticLabel: 'Every day. It cannot be turned off.', + ), ), const SizedBox(height: 32), SizedBox( @@ -139,11 +148,14 @@ class HomeBody extends StatelessWidget { ), if (!configured) ...[ const SizedBox(height: 16), - Icon( - Icons.cloud_off, - size: 28, - color: theme.extension()!.warning, - semanticLabel: 'Open Settings to connect Firebase', + Tooltip( + message: 'Offline', + child: Icon( + Icons.cloud_off, + size: 28, + color: theme.extension()!.warning, + semanticLabel: 'Open Settings to connect Firebase', + ), ), ], ], diff --git a/phone_app/lib/screens/home_screen.dart b/phone_app/lib/screens/home_screen.dart index 55f6aa2..811a9f0 100644 --- a/phone_app/lib/screens/home_screen.dart +++ b/phone_app/lib/screens/home_screen.dart @@ -183,6 +183,7 @@ class _HomeScreenState extends State { color: Theme.of(context).colorScheme.onSurfaceVariant, semanticLabel: 'Free days', ), + tooltip: 'Free-days', onPressed: () => Navigator.push( context, appRoute(context, (_) => const FreeDaysScreen()), @@ -194,6 +195,7 @@ class _HomeScreenState extends State { color: Theme.of(context).colorScheme.onSurfaceVariant, semanticLabel: 'Sick days', ), + tooltip: 'Sick-days', onPressed: () => Navigator.push( context, appRoute(context, (_) => const SickDaysScreen()), diff --git a/phone_app/lib/screens/ring_stakes_line.dart b/phone_app/lib/screens/ring_stakes_line.dart index 1c8bd30..60f3bc3 100644 --- a/phone_app/lib/screens/ring_stakes_line.dart +++ b/phone_app/lib/screens/ring_stakes_line.dart @@ -62,13 +62,19 @@ class _RingStakesLineState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.gavel_outlined, color: warningColor), + Tooltip( + message: 'Deadline', + child: Icon(Icons.gavel_outlined, color: warningColor), + ), const SizedBox(width: 4), Text(hhmm(stakes.by), style: TextStyle(color: warningColor)), const SizedBox(width: 4), const Icon(Icons.arrow_forward, size: 16), const SizedBox(width: 4), - Icon(Icons.lock_outline, color: warningColor), + Tooltip( + message: 'Lock', + child: Icon(Icons.lock_outline, color: warningColor), + ), const SizedBox(width: 4), Text( _formatLockDate(stakes.lockThrough), diff --git a/phone_app/lib/screens/settings_screen.dart b/phone_app/lib/screens/settings_screen.dart index 8322073..6d77c48 100644 --- a/phone_app/lib/screens/settings_screen.dart +++ b/phone_app/lib/screens/settings_screen.dart @@ -93,20 +93,26 @@ class SettingsScreen extends StatelessWidget { locked: locked, ), ), - IconButton( - key: const Key('settings-export'), - icon: const Icon(Icons.upload_file, semanticLabel: 'Export data'), - onPressed: () => _run(context, () async { - await (onExport ?? () => saveExport(alarm: alarmService))(); - return true; - }), + Tooltip( + message: 'Export', + child: IconButton( + key: const Key('settings-export'), + icon: const Icon(Icons.upload_file, semanticLabel: 'Export data'), + onPressed: () => _run(context, () async { + await (onExport ?? () => saveExport(alarm: alarmService))(); + return true; + }), + ), ), - IconButton( - key: const Key('settings-import'), - icon: const Icon(Icons.download, semanticLabel: 'Import data'), - onPressed: () => _run( - context, - onImport ?? () => pickAndImport(alarm: alarmService), + Tooltip( + message: 'Import', + child: IconButton( + key: const Key('settings-import'), + icon: const Icon(Icons.download, semanticLabel: 'Import data'), + onPressed: () => _run( + context, + onImport ?? () => pickAndImport(alarm: alarmService), + ), ), ), ], diff --git a/phone_app/lib/screens/stakes_marks.dart b/phone_app/lib/screens/stakes_marks.dart index 498c227..c059228 100644 --- a/phone_app/lib/screens/stakes_marks.dart +++ b/phone_app/lib/screens/stakes_marks.dart @@ -32,7 +32,10 @@ class StakesMarks extends StatelessWidget { }; final rows = [ _row('title', view.title, [ - Icon(kindIcon, color: theme.colorScheme.primary), + Tooltip( + message: 'Stakes', + child: Icon(kindIcon, color: theme.colorScheme.primary), + ), Icon(view.isToday ? Icons.today : Icons.event, size: 18), Text(_dm(view.day), style: theme.textTheme.titleMedium), ]), @@ -46,34 +49,39 @@ class StakesMarks extends StatelessWidget { if (dismissBy != null && lock != null) { rows.add( _row('stick', words.first, [ - const Icon(Icons.alarm), + const Tooltip(message: 'Alarm', child: Icon(Icons.alarm)), Text(hhmm(dismissBy)), const Icon(Icons.arrow_forward, size: 16), - const Icon(Icons.lock_outline), + const Tooltip(message: 'Lock', child: Icon(Icons.lock_outline)), Text(_dm(lock)), ]), ); } else if (finishBy != null && open != null) { rows.add( _row('carrot', words.first, [ - const Icon(Icons.flag_outlined), + const Tooltip(message: 'Finish', child: Icon(Icons.flag_outlined)), Text(hhmm(finishBy)), const Icon(Icons.arrow_forward, size: 16), - const Icon(Icons.computer), + const Tooltip(message: 'PC', child: Icon(Icons.computer)), Text(_hm(open.hour, open.minute)), ]), ); } else if (view.kind != StakesDayKind.free && view.kind != StakesDayKind.sick) { rows.add( - _row('unarmed', words.first, const [Icon(Icons.alarm_off)]), + _row('unarmed', words.first, const [ + Tooltip(message: 'Off', child: Icon(Icons.alarm_off)), + ]), ); } if (ring != null) { rows.add( _row('pc-ring', words.last, [ - const Icon(Icons.computer), - const Icon(Icons.notifications_active_outlined), + const Tooltip(message: 'PC', child: Icon(Icons.computer)), + const Tooltip( + message: 'Ring', + child: Icon(Icons.notifications_active_outlined), + ), Text(hhmm(ring)), ]), ); @@ -104,18 +112,30 @@ class StakesMarks extends StatelessWidget { return [ if (view.escapedToday) _row('escaped', next(), [ - Icon(Icons.bug_report_outlined, color: warning), + Tooltip( + message: 'Escaped', + child: Icon(Icons.bug_report_outlined, color: warning), + ), Icon(Icons.check, color: warning), ]), if (locked != null) _row('locked', next(), [ - Icon(Icons.lock_outline, color: warning), + Tooltip( + message: 'Lock', + child: Icon(Icons.lock_outline, color: warning), + ), Text(_dm(locked), style: style), ]), if (view.missedToday) _row('missed', next(), [ - Icon(Icons.close, color: warning), - Icon(Icons.computer, color: warning), + Tooltip( + message: 'Missed', + child: Icon(Icons.close, color: warning), + ), + Tooltip( + message: 'PC', + child: Icon(Icons.computer, color: warning), + ), ]), ]; } diff --git a/phone_app/test/services/sync_emulator_test.dart b/phone_app/test/services/sync_emulator_test.dart index 806acd3..46cb838 100644 --- a/phone_app/test/services/sync_emulator_test.dart +++ b/phone_app/test/services/sync_emulator_test.dart @@ -9,14 +9,17 @@ import 'package:wake_alarm_sync/services/sync_emulator.dart'; class _Github extends Fake implements RemoteStore {} void main() { - test('a build without the define syncs to prod, never the emulator', () async { - expect(kSyncEmulatorUrl, isEmpty); - expect(syncEmulatorOn, isFalse); - expect(kProject.databaseUrl, contains('kuhy-syncs')); - final github = _Github(); - // No Firebase session in tests: prod's rollback path, GitHub alone. - expect(await syncBackend(github), same(github)); - }); + test( + 'a build without the define syncs to prod, never the emulator', + () async { + expect(kSyncEmulatorUrl, isEmpty); + expect(syncEmulatorOn, isFalse); + expect(kProject.databaseUrl, contains('kuhy-syncs')); + final github = _Github(); + // No Firebase session in tests: prod's rollback path, GitHub alone. + expect(await syncBackend(github), same(github)); + }, + ); test('the emulator client signs as owner against the given origin', () async { final seen = []; diff --git a/phone_app/test/text_free_support.dart b/phone_app/test/text_free_support.dart index dfb8f70..73dbb53 100644 --- a/phone_app/test/text_free_support.dart +++ b/phone_app/test/text_free_support.dart @@ -51,7 +51,14 @@ void _collectSubtree(Element element, Set out) { void expectNoWords(WidgetTester tester, String screen) { final words = wordsOnScreen(tester); expect(words, isEmpty, reason: 'words on $screen: $words'); - expect(find.byType(Tooltip), findsNothing, reason: 'tooltip on $screen'); + final tooltips = tester.widgetList(find.byType(Tooltip)); + for (final tooltip in tooltips) { + expect( + tooltip.message, + matches(RegExp(r'^[^\s.!?,;:]{1,20}$')), + reason: 'tooltip on $screen: ${tooltip.message}', + ); + } } /// Pixel 6a portrait: 1080x2400 physical at 2.625. diff --git a/phone_app/test/tooltips_test.dart b/phone_app/test/tooltips_test.dart new file mode 100644 index 0000000..888d25b --- /dev/null +++ b/phone_app/test/tooltips_test.dart @@ -0,0 +1,32 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:material_ui/material_ui.dart'; +import 'package:wake_alarm_sync/screens/free_days_screen.dart'; +import 'package:wake_alarm_sync/screens/settings_screen.dart' + show SettingsScreen; +import 'package:wake_alarm_sync/services/free_day_sync.dart'; +import 'package:wake_alarm_sync/ui/theme.dart'; + +void main() { + testWidgets('settings export/import have one-word tooltips', (tester) async { + await tester.pumpWidget( + MaterialApp(theme: buildAppTheme(), home: const SettingsScreen()), + ); + + expect(find.byTooltip('Export'), findsOneWidget); + expect(find.byTooltip('Import'), findsOneWidget); + }); + + testWidgets('free days sync has one-word tooltip', (tester) async { + await tester.pumpWidget( + MaterialApp( + theme: buildAppTheme(), + home: FreeDaysScreen( + openPool: () async => throw Exception('test'), + syncer: FreeDaySync(), + ), + ), + ); + + expect(find.byTooltip('Sync'), findsOneWidget); + }); +}