state static method

void state(
  1. BuildContext context,
  2. ActionState state, {
  3. String? label,
  4. HighlightStyle? style,
  5. 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);
}