state static method
void
state(
- BuildContext context,
- ActionState state, {
- String? label,
- HighlightStyle? style,
- Duration? duration,
State pill at the top of the screen — "tapping", "verifying", etc.
Optional label overrides the default text (e.g. "tapping ‘Submit’").
Implementation
static void state(
BuildContext context,
ActionState state, {
String? label,
HighlightStyle? style,
Duration? duration,
}) {
if (!HighlighterConfig.enabled) return;
final overlay = _resolveOverlay(context);
if (overlay == null) return;
_stateEntry?.remove();
final effectiveStyle = style ?? _styleForState(state);
final effectiveDuration =
duration ?? HighlighterConfig.defaultStateBadgeDuration;
late OverlayEntry entry;
entry = OverlayEntry(
builder: (_) => _StateBadgeLayer(
state: state,
label: label ?? _labelForState(state),
style: effectiveStyle,
duration: effectiveDuration,
onDone: () {
if (_stateEntry == entry) {
entry.remove();
_stateEntry = null;
}
},
),
);
_stateEntry = entry;
overlay.insert(entry);
}