utils/sync_settings_ui/lib/src/sync_settings_cues.dart
Krzysztof kuhy Rudnicki 0ef5461805
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (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
github_device_auth tests / test (push) Has been cancelled
Move sync UI packages to material_ui
Flutter 3.50 deprecates package:flutter/material.dart. An app on
material_ui gives flutter/material widgets no MaterialLocalizations,
so sync_settings_ui 0.8.0 and github_device_auth 0.5.0 move first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:03:03 +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 new(this.icon, this.spoken) : error = false;
const new 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 new(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 new(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,
),
);
}