ProgressBar constructor

ProgressBar({
  1. int maxValue = 100,
  2. Coordinate? startCoordinate,
  3. int? barWidth,
  4. bool showSpinner = true,
  5. List<String> tickCharacters = const <String>['-', '\\', '|', '/'],
})

Implementation

ProgressBar(
    {this.maxValue = 100,
    Coordinate? startCoordinate,
    int? barWidth,
    this.showSpinner = true,
    this.tickCharacters = const <String>['-', '\\', '|', '/']}) {
  if (!_console.hasTerminal) {
    _shouldDrawProgress = false;
  } else {
    _shouldDrawProgress = true;
    _startCoordinate = startCoordinate ?? _console.cursorPosition;
    _width = barWidth ?? _console.windowWidth;
    _innerWidth = (barWidth ?? _console.windowWidth) - 2;

    _printProgressBar('[${' ' * _innerWidth}]');
  }
}