Continue showing status messages after a startProgress completes (#6720)
This commit is contained in:
parent
34fdc44b58
commit
54d76518ac
@ -41,6 +41,8 @@ class Status {
|
|||||||
void cancel() { }
|
void cancel() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef void _FinishCallback();
|
||||||
|
|
||||||
class StdoutLogger extends Logger {
|
class StdoutLogger extends Logger {
|
||||||
Status _status;
|
Status _status;
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ class StdoutLogger extends Logger {
|
|||||||
return new Status();
|
return new Status();
|
||||||
} else {
|
} else {
|
||||||
if (supportsColor) {
|
if (supportsColor) {
|
||||||
_status = new _AnsiStatus(message);
|
_status = new _AnsiStatus(message, () { _status = null; });
|
||||||
return _status;
|
return _status;
|
||||||
} else {
|
} else {
|
||||||
printStatus(message);
|
printStatus(message);
|
||||||
@ -223,7 +225,7 @@ class AnsiTerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AnsiStatus extends Status {
|
class _AnsiStatus extends Status {
|
||||||
_AnsiStatus(this.message) {
|
_AnsiStatus(this.message, this.onFinish) {
|
||||||
stopwatch = new Stopwatch()..start();
|
stopwatch = new Stopwatch()..start();
|
||||||
|
|
||||||
stdout.write('${message.padRight(51)} ');
|
stdout.write('${message.padRight(51)} ');
|
||||||
@ -235,6 +237,7 @@ class _AnsiStatus extends Status {
|
|||||||
static final List<String> _progress = <String>['-', r'\', '|', r'/', '-', r'\', '|', '/'];
|
static final List<String> _progress = <String>['-', r'\', '|', r'/', '-', r'\', '|', '/'];
|
||||||
|
|
||||||
final String message;
|
final String message;
|
||||||
|
final _FinishCallback onFinish;
|
||||||
Stopwatch stopwatch;
|
Stopwatch stopwatch;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
int index = 1;
|
int index = 1;
|
||||||
@ -247,6 +250,8 @@ class _AnsiStatus extends Status {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void stop({ bool showElapsedTime: true }) {
|
void stop({ bool showElapsedTime: true }) {
|
||||||
|
onFinish();
|
||||||
|
|
||||||
if (!live)
|
if (!live)
|
||||||
return;
|
return;
|
||||||
live = false;
|
live = false;
|
||||||
@ -262,6 +267,8 @@ class _AnsiStatus extends Status {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void cancel() {
|
void cancel() {
|
||||||
|
onFinish();
|
||||||
|
|
||||||
if (!live)
|
if (!live)
|
||||||
return;
|
return;
|
||||||
live = false;
|
live = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user