progressBar method
Creates an inline progress bar: ████░░░░ 75%
Implementation
String progressBar(
double ratio, {
int width = 10,
bool showPercent = true,
String filledChar = '█',
String emptyChar = '░',
}) {
final clamped = ratio.clamp(0.0, 1.0);
final filled = (clamped * width).round();
final bar =
'${theme.accent}${filledChar * filled}${theme.reset}${theme.dim}${emptyChar * (width - filled)}${theme.reset}';
if (showPercent) {
final pct = (clamped * 100).round();
return '$bar ${dim('$pct%')}';
}
return bar;
}