pub package

Languages:

English Russian

About package

The package provides the ability to output the progress bar to the terminal, change its appearance and change the degree of progress in it.

Example

Alt Text

Alt Text

How to use

The progress bar consists of 3 main parts:

  • before. Arbitrary user content. In the scheme, it is marked with the #before tag. If it is null, then nothing will be output instead of the #before tag;
  • bar. In the scheme, it is marked with the #bar tag, instead of the tag, the progress bar itself will be output;
  • after. Arbitrary user content. In the scheme, it is marked with the #after tag. If null, then nothing will be output instead of the #after tag.

When creating progress bar, you must specify the scheme. The scheme uses tags to indicate the places where the content will be displayed.

Example of the scheme: '#before #bar #after'. Instead of the #before tag, the before content will be output, instead of the #after tag, the after content will be output, instead of the #bar tag, the progress bar itself will be output.

Example of creating and launching progress bar, increasing its fullness:

final schema = '#before [#bar] #after';

final max = 100;

final bar = ProgressBar(
    schema: schema,
    before: 'Progress',
    after: '0/$max',
    settings: ProgressBarSettings(
        max: max,
        size: 100 * 0.1,
    ),
);

bar.update();

bar.setProgress(10);

bar.update();

You can change the appearance and settings of your progress bar using ProgressBarSettings:

  • max. Maximum progress;
  • size. The size of the progress bar in characters;
  • filled. The symbol of the filled part;
  • notFilled. Blank part symbol;
  • edge. The symbol of the extreme character of the filled part.

Libraries

cli_progress_bar