Audit icons: add 1-word hover tooltips
Some checks failed
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,free-days-interop,dependency-freshness) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / free-days-interop (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
release-apk / release (APK) (push) Has been cancelled

Todo: fe70b845
This commit is contained in:
Krzysztof Rudnicki 2026-11-22 19:20:38 +01:00
parent be45e5969a
commit 0059d44571
10 changed files with 181 additions and 81 deletions

View File

@ -176,10 +176,13 @@ class _FreeDaysScreenState extends State<FreeDaysScreen> {
appBar: AppBar( appBar: AppBar(
// title removed // title removed
actions: [ actions: [
IconButton( Tooltip(
message: 'Sync',
child: IconButton(
icon: const Icon(Icons.sync, semanticLabel: 'Sync now'), icon: const Icon(Icons.sync, semanticLabel: 'Sync now'),
onPressed: _busy ? null : () => unawaited(_sync()), onPressed: _busy ? null : () => unawaited(_sync()),
), ),
),
], ],
), ),
body: pool == null body: pool == null

View File

@ -94,7 +94,9 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Icon( Tooltip(
message: isConnected ? 'Connected' : 'Disconnected',
child: Icon(
isConnected ? Icons.link : Icons.link_off, isConnected ? Icons.link : Icons.link_off,
color: isConnected color: isConnected
? Theme.of(context).colorScheme.tertiary ? Theme.of(context).colorScheme.tertiary
@ -104,18 +106,24 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
? 'Connected to GitHub.' ? 'Connected to GitHub.'
: 'Not connected to GitHub.', : 'Not connected to GitHub.',
), ),
),
const SizedBox(height: 12), const SizedBox(height: 12),
if (!isConnected) if (!isConnected)
ElevatedButton( Tooltip(
message: 'Connect',
child: ElevatedButton(
key: const ValueKey<String>('github-connect'), key: const ValueKey<String>('github-connect'),
onPressed: _busy ? null : _connectGitHub, onPressed: _busy ? null : _connectGitHub,
child: const Icon( child: const Icon(
Icons.link, Icons.link,
semanticLabel: 'Connect GitHub', semanticLabel: 'Connect GitHub',
), ),
),
) )
else else
OutlinedButton( Tooltip(
message: 'Disconnect',
child: OutlinedButton(
key: const ValueKey<String>('github-disconnect'), key: const ValueKey<String>('github-disconnect'),
onPressed: _busy ? null : _disconnect, onPressed: _busy ? null : _disconnect,
child: const Icon( child: const Icon(
@ -123,6 +131,7 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
semanticLabel: 'Disconnect GitHub', semanticLabel: 'Disconnect GitHub',
), ),
), ),
),
const SizedBox(height: 16), const SizedBox(height: 16),
StatusCue(semanticLabel: _status), StatusCue(semanticLabel: _status),
], ],

View File

@ -77,12 +77,15 @@ class HomeBody extends StatelessWidget {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Tooltip(
message: 'Armed',
child: Icon(
Icons.alarm_on, Icons.alarm_on,
size: 32, size: 32,
color: theme.colorScheme.primary, color: theme.colorScheme.primary,
semanticLabel: 'Alarm is armed for', semanticLabel: 'Alarm is armed for',
), ),
),
HomePresenceLine(key: ValueKey<int>(syncEpoch)), HomePresenceLine(key: ValueKey<int>(syncEpoch)),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
@ -96,23 +99,29 @@ class HomeBody extends StatelessWidget {
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Tooltip(
message: 'Oneshot',
child: Icon(
Icons.restore, Icons.restore,
size: 18, size: 18,
semanticLabel: semanticLabel:
'One-shot early start, back to $baseline ' 'One-shot early start, back to $baseline '
'after it rings', 'after it rings',
), ),
),
Text(baseline), Text(baseline),
], ],
) )
else else
Icon( Tooltip(
message: 'Daily',
child: Icon(
Icons.all_inclusive, Icons.all_inclusive,
size: 18, size: 18,
color: theme.colorScheme.onSurfaceVariant, color: theme.colorScheme.onSurfaceVariant,
semanticLabel: 'Every day. It cannot be turned off.', semanticLabel: 'Every day. It cannot be turned off.',
), ),
),
const SizedBox(height: 32), const SizedBox(height: 32),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
@ -139,12 +148,15 @@ class HomeBody extends StatelessWidget {
), ),
if (!configured) ...[ if (!configured) ...[
const SizedBox(height: 16), const SizedBox(height: 16),
Icon( Tooltip(
message: 'Offline',
child: Icon(
Icons.cloud_off, Icons.cloud_off,
size: 28, size: 28,
color: theme.extension<AppStatusColors>()!.warning, color: theme.extension<AppStatusColors>()!.warning,
semanticLabel: 'Open Settings to connect Firebase', semanticLabel: 'Open Settings to connect Firebase',
), ),
),
], ],
], ],
), ),

View File

@ -183,6 +183,7 @@ class _HomeScreenState extends State<HomeScreen> {
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.onSurfaceVariant,
semanticLabel: 'Free days', semanticLabel: 'Free days',
), ),
tooltip: 'Free-days',
onPressed: () => Navigator.push<void>( onPressed: () => Navigator.push<void>(
context, context,
appRoute<void>(context, (_) => const FreeDaysScreen()), appRoute<void>(context, (_) => const FreeDaysScreen()),
@ -194,6 +195,7 @@ class _HomeScreenState extends State<HomeScreen> {
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.onSurfaceVariant,
semanticLabel: 'Sick days', semanticLabel: 'Sick days',
), ),
tooltip: 'Sick-days',
onPressed: () => Navigator.push<void>( onPressed: () => Navigator.push<void>(
context, context,
appRoute<void>(context, (_) => const SickDaysScreen()), appRoute<void>(context, (_) => const SickDaysScreen()),

View File

@ -62,13 +62,19 @@ class _RingStakesLineState extends State<RingStakesLine> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Icon(Icons.gavel_outlined, color: warningColor), Tooltip(
message: 'Deadline',
child: Icon(Icons.gavel_outlined, color: warningColor),
),
const SizedBox(width: 4), const SizedBox(width: 4),
Text(hhmm(stakes.by), style: TextStyle(color: warningColor)), Text(hhmm(stakes.by), style: TextStyle(color: warningColor)),
const SizedBox(width: 4), const SizedBox(width: 4),
const Icon(Icons.arrow_forward, size: 16), const Icon(Icons.arrow_forward, size: 16),
const SizedBox(width: 4), const SizedBox(width: 4),
Icon(Icons.lock_outline, color: warningColor), Tooltip(
message: 'Lock',
child: Icon(Icons.lock_outline, color: warningColor),
),
const SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
_formatLockDate(stakes.lockThrough), _formatLockDate(stakes.lockThrough),

View File

@ -93,7 +93,9 @@ class SettingsScreen extends StatelessWidget {
locked: locked, locked: locked,
), ),
), ),
IconButton( Tooltip(
message: 'Export',
child: IconButton(
key: const Key('settings-export'), key: const Key('settings-export'),
icon: const Icon(Icons.upload_file, semanticLabel: 'Export data'), icon: const Icon(Icons.upload_file, semanticLabel: 'Export data'),
onPressed: () => _run(context, () async { onPressed: () => _run(context, () async {
@ -101,7 +103,10 @@ class SettingsScreen extends StatelessWidget {
return true; return true;
}), }),
), ),
IconButton( ),
Tooltip(
message: 'Import',
child: IconButton(
key: const Key('settings-import'), key: const Key('settings-import'),
icon: const Icon(Icons.download, semanticLabel: 'Import data'), icon: const Icon(Icons.download, semanticLabel: 'Import data'),
onPressed: () => _run( onPressed: () => _run(
@ -109,6 +114,7 @@ class SettingsScreen extends StatelessWidget {
onImport ?? () => pickAndImport(alarm: alarmService), onImport ?? () => pickAndImport(alarm: alarmService),
), ),
), ),
),
], ],
), ),
body: ListView( body: ListView(

View File

@ -32,7 +32,10 @@ class StakesMarks extends StatelessWidget {
}; };
final rows = <Widget>[ final rows = <Widget>[
_row('title', view.title, <Widget>[ _row('title', view.title, <Widget>[
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), Icon(view.isToday ? Icons.today : Icons.event, size: 18),
Text(_dm(view.day), style: theme.textTheme.titleMedium), Text(_dm(view.day), style: theme.textTheme.titleMedium),
]), ]),
@ -46,34 +49,39 @@ class StakesMarks extends StatelessWidget {
if (dismissBy != null && lock != null) { if (dismissBy != null && lock != null) {
rows.add( rows.add(
_row('stick', words.first, <Widget>[ _row('stick', words.first, <Widget>[
const Icon(Icons.alarm), const Tooltip(message: 'Alarm', child: Icon(Icons.alarm)),
Text(hhmm(dismissBy)), Text(hhmm(dismissBy)),
const Icon(Icons.arrow_forward, size: 16), const Icon(Icons.arrow_forward, size: 16),
const Icon(Icons.lock_outline), const Tooltip(message: 'Lock', child: Icon(Icons.lock_outline)),
Text(_dm(lock)), Text(_dm(lock)),
]), ]),
); );
} else if (finishBy != null && open != null) { } else if (finishBy != null && open != null) {
rows.add( rows.add(
_row('carrot', words.first, <Widget>[ _row('carrot', words.first, <Widget>[
const Icon(Icons.flag_outlined), const Tooltip(message: 'Finish', child: Icon(Icons.flag_outlined)),
Text(hhmm(finishBy)), Text(hhmm(finishBy)),
const Icon(Icons.arrow_forward, size: 16), 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)), Text(_hm(open.hour, open.minute)),
]), ]),
); );
} else if (view.kind != StakesDayKind.free && } else if (view.kind != StakesDayKind.free &&
view.kind != StakesDayKind.sick) { view.kind != StakesDayKind.sick) {
rows.add( rows.add(
_row('unarmed', words.first, const <Widget>[Icon(Icons.alarm_off)]), _row('unarmed', words.first, const <Widget>[
Tooltip(message: 'Off', child: Icon(Icons.alarm_off)),
]),
); );
} }
if (ring != null) { if (ring != null) {
rows.add( rows.add(
_row('pc-ring', words.last, <Widget>[ _row('pc-ring', words.last, <Widget>[
const Icon(Icons.computer), const Tooltip(message: 'PC', child: Icon(Icons.computer)),
const Icon(Icons.notifications_active_outlined), const Tooltip(
message: 'Ring',
child: Icon(Icons.notifications_active_outlined),
),
Text(hhmm(ring)), Text(hhmm(ring)),
]), ]),
); );
@ -104,18 +112,30 @@ class StakesMarks extends StatelessWidget {
return <Widget>[ return <Widget>[
if (view.escapedToday) if (view.escapedToday)
_row('escaped', next(), <Widget>[ _row('escaped', next(), <Widget>[
Icon(Icons.bug_report_outlined, color: warning), Tooltip(
message: 'Escaped',
child: Icon(Icons.bug_report_outlined, color: warning),
),
Icon(Icons.check, color: warning), Icon(Icons.check, color: warning),
]), ]),
if (locked != null) if (locked != null)
_row('locked', next(), <Widget>[ _row('locked', next(), <Widget>[
Icon(Icons.lock_outline, color: warning), Tooltip(
message: 'Lock',
child: Icon(Icons.lock_outline, color: warning),
),
Text(_dm(locked), style: style), Text(_dm(locked), style: style),
]), ]),
if (view.missedToday) if (view.missedToday)
_row('missed', next(), <Widget>[ _row('missed', next(), <Widget>[
Icon(Icons.close, color: warning), Tooltip(
Icon(Icons.computer, color: warning), message: 'Missed',
child: Icon(Icons.close, color: warning),
),
Tooltip(
message: 'PC',
child: Icon(Icons.computer, color: warning),
),
]), ]),
]; ];
} }

View File

@ -9,14 +9,17 @@ import 'package:wake_alarm_sync/services/sync_emulator.dart';
class _Github extends Fake implements RemoteStore {} class _Github extends Fake implements RemoteStore {}
void main() { void main() {
test('a build without the define syncs to prod, never the emulator', () async { test(
'a build without the define syncs to prod, never the emulator',
() async {
expect(kSyncEmulatorUrl, isEmpty); expect(kSyncEmulatorUrl, isEmpty);
expect(syncEmulatorOn, isFalse); expect(syncEmulatorOn, isFalse);
expect(kProject.databaseUrl, contains('kuhy-syncs')); expect(kProject.databaseUrl, contains('kuhy-syncs'));
final github = _Github(); final github = _Github();
// No Firebase session in tests: prod's rollback path, GitHub alone. // No Firebase session in tests: prod's rollback path, GitHub alone.
expect(await syncBackend(github), same(github)); expect(await syncBackend(github), same(github));
}); },
);
test('the emulator client signs as owner against the given origin', () async { test('the emulator client signs as owner against the given origin', () async {
final seen = <Uri>[]; final seen = <Uri>[];

View File

@ -51,7 +51,14 @@ void _collectSubtree(Element element, Set<Element> out) {
void expectNoWords(WidgetTester tester, String screen) { void expectNoWords(WidgetTester tester, String screen) {
final words = wordsOnScreen(tester); final words = wordsOnScreen(tester);
expect(words, isEmpty, reason: 'words on $screen: $words'); expect(words, isEmpty, reason: 'words on $screen: $words');
expect(find.byType(Tooltip), findsNothing, reason: 'tooltip on $screen'); final tooltips = tester.widgetList<Tooltip>(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. /// Pixel 6a portrait: 1080x2400 physical at 2.625.

View File

@ -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);
});
}