scanner static method
Creates a Knight Rider scanner animation.
The scanner oscillates bidirectionally (left → right → left) with configurable hold frames at each end, producing a glowing sweep effect across the bar.
Parameters:
color— The bright color for the scanner head (defaults to Colors.purple).width— Number of character positions (default 8).chars— Character set for active/inactive positions (default ScannerChars.blocks).holdStart— Frames to hold at the start position (default 30).holdEnd— Frames to hold at the end position (default 9).trailSteps— Number of gradient steps in the trail (default 6).fps— Frame interval duration (default 40ms, matching opencode).
Implementation
static Spinner scanner({
Color? color,
int width = 8,
ScannerCharSet chars = ScannerChars.blocks,
int holdStart = 30,
int holdEnd = 9,
int trailSteps = 6,
Duration fps = const Duration(milliseconds: 40),
}) {
final c = color ?? Colors.purple;
final trail = deriveTrail(c, steps: trailSteps);
final inactive = deriveInactive(c);
final frames = _generateScannerFrames(
width: width,
chars: chars,
trail: trail,
inactiveColor: inactive,
holdStart: holdStart,
holdEnd: holdEnd,
);
return Spinner(frames: frames, fps: fps);
}