utils/sync_settings_ui/lib/src/sync_settings_cues.dart
Krzysztof kuhy Rudnicki 3084080d74
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
github_device_auth tests / test (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
sync_settings_ui tests / test (push) Waiting to run
sync_settings_ui 0.7.0, gda 0.4.0: text-free
Glyph + spoken label replaces every app-written string on the shared
Sync settings screen and the GitHub device-code dialog (kuhy's
textgate rule). Old sentences are semantics labels; tests find them
there. The device user code stays visible (GitHub's data).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 01:27:57 +01:00

57 lines
1.4 KiB
Dart

part of 'sync_settings_screen.dart';
/// The screen's glyph vocabulary, in place of written headings and status
/// sentences (kuhy's textgate rule). Every old sentence survives as the
/// spoken label, so screen readers and widget tests still find it.
/// A result: a glyph, the old sentence (spoken only), and whether it is a
/// failure. Colour is the second channel: danger hue for failures.
class _Cue {
const _Cue(this.icon, this.spoken) : error = false;
const _Cue.error(this.icon, this.spoken) : error = true;
final IconData icon;
final String spoken;
final bool error;
}
/// Paints a [_Cue] as a large glyph.
class _CueView extends StatelessWidget {
const _CueView(this.cue);
final _Cue cue;
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Align(
alignment: Alignment.centerLeft,
child: Icon(
cue.icon,
size: 32,
color: cue.error ? scheme.error : scheme.primary,
semanticLabel: cue.spoken,
),
);
}
}
/// A section heading as a glyph, spoken as [spoken].
class _Heading extends StatelessWidget {
const _Heading(this.icon, this.spoken);
final IconData icon;
final String spoken;
@override
Widget build(BuildContext context) => Align(
alignment: Alignment.centerLeft,
child: Icon(
icon,
color: Theme.of(context).colorScheme.primary,
semanticLabel: spoken,
),
);
}