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(
// 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()),
),
),
],
),

View File

@ -94,33 +94,42 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen> {
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<String>('github-connect'),
onPressed: _busy ? null : _connectGitHub,
child: const Icon(
Icons.link,
semanticLabel: 'Connect GitHub',
Tooltip(
message: 'Connect',
child: ElevatedButton(
key: const ValueKey<String>('github-connect'),
onPressed: _busy ? null : _connectGitHub,
child: const Icon(
Icons.link,
semanticLabel: 'Connect GitHub',
),
),
)
else
OutlinedButton(
key: const ValueKey<String>('github-disconnect'),
onPressed: _busy ? null : _disconnect,
child: const Icon(
Icons.link_off,
semanticLabel: 'Disconnect GitHub',
Tooltip(
message: 'Disconnect',
child: OutlinedButton(
key: const ValueKey<String>('github-disconnect'),
onPressed: _busy ? null : _disconnect,
child: const Icon(
Icons.link_off,
semanticLabel: 'Disconnect GitHub',
),
),
),
const SizedBox(height: 16),

View File

@ -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<int>(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<AppStatusColors>()!.warning,
semanticLabel: 'Open Settings to connect Firebase',
Tooltip(
message: 'Offline',
child: Icon(
Icons.cloud_off,
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,
semanticLabel: 'Free days',
),
tooltip: 'Free-days',
onPressed: () => Navigator.push<void>(
context,
appRoute<void>(context, (_) => const FreeDaysScreen()),
@ -194,6 +195,7 @@ class _HomeScreenState extends State<HomeScreen> {
color: Theme.of(context).colorScheme.onSurfaceVariant,
semanticLabel: 'Sick days',
),
tooltip: 'Sick-days',
onPressed: () => Navigator.push<void>(
context,
appRoute<void>(context, (_) => const SickDaysScreen()),

View File

@ -62,13 +62,19 @@ class _RingStakesLineState extends State<RingStakesLine> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
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),

View File

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

View File

@ -32,7 +32,10 @@ class StakesMarks extends StatelessWidget {
};
final rows = <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),
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, <Widget>[
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, <Widget>[
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 <Widget>[Icon(Icons.alarm_off)]),
_row('unarmed', words.first, const <Widget>[
Tooltip(message: 'Off', child: Icon(Icons.alarm_off)),
]),
);
}
if (ring != null) {
rows.add(
_row('pc-ring', words.last, <Widget>[
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 <Widget>[
if (view.escapedToday)
_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),
]),
if (locked != null)
_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),
]),
if (view.missedToday)
_row('missed', next(), <Widget>[
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),
),
]),
];
}

View File

@ -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 = <Uri>[];

View File

@ -51,7 +51,14 @@ void _collectSubtree(Element element, Set<Element> 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<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.

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