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

View File

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

View File

@ -77,11 +77,14 @@ class HomeBody extends StatelessWidget {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Tooltip(
Icons.alarm_on, message: 'Armed',
size: 32, child: Icon(
color: theme.colorScheme.primary, Icons.alarm_on,
semanticLabel: 'Alarm is armed for', size: 32,
color: theme.colorScheme.primary,
semanticLabel: 'Alarm is armed for',
),
), ),
HomePresenceLine(key: ValueKey<int>(syncEpoch)), HomePresenceLine(key: ValueKey<int>(syncEpoch)),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -96,22 +99,28 @@ class HomeBody extends StatelessWidget {
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Tooltip(
Icons.restore, message: 'Oneshot',
size: 18, child: Icon(
semanticLabel: Icons.restore,
'One-shot early start, back to $baseline ' size: 18,
'after it rings', semanticLabel:
'One-shot early start, back to $baseline '
'after it rings',
),
), ),
Text(baseline), Text(baseline),
], ],
) )
else else
Icon( Tooltip(
Icons.all_inclusive, message: 'Daily',
size: 18, child: Icon(
color: theme.colorScheme.onSurfaceVariant, Icons.all_inclusive,
semanticLabel: 'Every day. It cannot be turned off.', size: 18,
color: theme.colorScheme.onSurfaceVariant,
semanticLabel: 'Every day. It cannot be turned off.',
),
), ),
const SizedBox(height: 32), const SizedBox(height: 32),
SizedBox( SizedBox(
@ -139,11 +148,14 @@ class HomeBody extends StatelessWidget {
), ),
if (!configured) ...[ if (!configured) ...[
const SizedBox(height: 16), const SizedBox(height: 16),
Icon( Tooltip(
Icons.cloud_off, message: 'Offline',
size: 28, child: Icon(
color: theme.extension<AppStatusColors>()!.warning, Icons.cloud_off,
semanticLabel: 'Open Settings to connect Firebase', size: 28,
color: theme.extension<AppStatusColors>()!.warning,
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,20 +93,26 @@ class SettingsScreen extends StatelessWidget {
locked: locked, locked: locked,
), ),
), ),
IconButton( Tooltip(
key: const Key('settings-export'), message: 'Export',
icon: const Icon(Icons.upload_file, semanticLabel: 'Export data'), child: IconButton(
onPressed: () => _run(context, () async { key: const Key('settings-export'),
await (onExport ?? () => saveExport(alarm: alarmService))(); icon: const Icon(Icons.upload_file, semanticLabel: 'Export data'),
return true; onPressed: () => _run(context, () async {
}), await (onExport ?? () => saveExport(alarm: alarmService))();
return true;
}),
),
), ),
IconButton( Tooltip(
key: const Key('settings-import'), message: 'Import',
icon: const Icon(Icons.download, semanticLabel: 'Import data'), child: IconButton(
onPressed: () => _run( key: const Key('settings-import'),
context, icon: const Icon(Icons.download, semanticLabel: 'Import data'),
onImport ?? () => pickAndImport(alarm: alarmService), onPressed: () => _run(
context,
onImport ?? () => pickAndImport(alarm: alarmService),
),
), ),
), ),
], ],

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(
expect(kSyncEmulatorUrl, isEmpty); 'a build without the define syncs to prod, never the emulator',
expect(syncEmulatorOn, isFalse); () async {
expect(kProject.databaseUrl, contains('kuhy-syncs')); expect(kSyncEmulatorUrl, isEmpty);
final github = _Github(); expect(syncEmulatorOn, isFalse);
// No Firebase session in tests: prod's rollback path, GitHub alone. expect(kProject.databaseUrl, contains('kuhy-syncs'));
expect(await syncBackend(github), same(github)); 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 { 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);
});
}