pulse static method
Breathing rectangular border around bounds.
Implementation
static void pulse(
BuildContext context,
Rect bounds, {
HighlightStyle? style,
Duration? duration,
}) {
if (!HighlighterConfig.enabled) return;
if (!ActionGates.instance.highlightingEnabled) return;
final overlay = _resolveOverlay(context);
if (overlay == null) return;
if (_pulseEntry != null &&
_pulseRect != null &&
_sameTargetBounds(_pulseRect!, bounds)) {
return;
}
_pulseEntry?.remove();
_pulseRect = null;
// Backend tuning (`action_config.effects.highlight`): stroke, corner
// radius and the auto-hide fallback. An explicit caller style/duration
// wins; the chasing palette itself is themed inside the painter.
final fx = ActionGates.instance.effects;
final effectiveStyle = style ??
HighlighterConfig.defaultStyle.copyWith(
strokeWidth: fx.highlightStroke,
cornerRadius: fx.highlightCornerRadius,
);
final effectiveDuration = duration ??
ActionEffects.duration(fx.highlightDefaultDurationMs,
HighlighterConfig.defaultPulseDuration);
late OverlayEntry entry;
entry = OverlayEntry(
builder: (_) => _PulseLayer(
rect: bounds,
style: effectiveStyle,
duration: effectiveDuration,
onDone: () {
if (_pulseEntry == entry) {
entry.remove();
_pulseEntry = null;
_pulseRect = null;
}
},
),
);
_pulseEntry = entry;
_pulseRect = bounds;
overlay.insert(entry);
}