FillingBar constructor
FillingBar({})
Arguments:
- total : Total number of steps
- desc : Simple text shown before the bar (optional)
- space : Character denoting empty space (default : '.')
- fill : Character denoting filled space (default : '█')
- time : Toggle timing mode (default : false)
- percentage : Toggle percentage display (default : false)
- scale : Scale of the bar relative to width (between: 0 and 1, default: 0.5, Irrelavant if width is specified)
- width : Width of the bar (If not specified, it will be automatically calculated using the terminal width and scale)
Implementation
FillingBar(
{required int total,
String desc = "",
this.space = ".",
this.fill = "█",
this.time = false,
this.percentage = false,
this.scale = 0.5,
this.width})
: _desc = desc,
_total = total {
// Handles width of the bar, throws an error if it's not specified and the terminal width is not available
try {
max = width ?? ((stdout.terminalColumns - _desc.length) * scale).toInt();
} on StdoutException {
throw StdoutException(
"Could not get terminal width, try specifying a width manually");
}
if (time) {
_clock.start();
scheduleMicrotask(autoRender);
}
_render();
}