build method
override
Declares this node's children and behavior.
Runs once on mount, and again on every rebuild.
super.build() is required, as skipping it drops whatever the superclass
declared.
Implementation
@override
void build() {
super.build();
tick((dt) {
if (_forward) {
controller.advance(dt);
} else {
controller.recede(dt);
}
if (!controller.hasStarted) {
_started = false;
return;
}
if (!_started) {
_started = true;
onStart.emit();
}
final progress = controller.progress;
if (progress == 1 && _previousProgress != 1) {
onMax.emit();
}
if (progress == 0 && _previousProgress != 0) {
onMin.emit();
}
onProgress.emit(progress);
_previousProgress = progress;
if (!controller.isFinished) {
_finished = false;
return;
}
if (_finished) {
return;
}
_finished = true;
onFinish.emit();
});
}