I have a a basic TweenAnimationBuilder
to animate a CircularProgressIndicator
which I want to repeat on click or onEnd animation :
Consumer<MyProvider>(
builder: (context, model, child) {
print("Reload");
return TweenAnimationBuilder<double>(
tween: Tween<double>(begin: 1, end: 0),
duration: Duration(seconds: 10),
onEnd: () {
myProvider.notify();
},
builder: (context, value, _) {
print("progress : " + value.toString());
return CircularProgressIndicator(
value: value,
strokeWidth: 2,
backgroundColor: Colors.transparent,
valueColor: AlwaysStoppedAnimation(Colors.white),
);
},
);
},
),
I'm using a Provider
to notify change and repeat the animation instead of setState()
.
The problem also occurs by calling setState()
When the Widget
is reloaded the animation is restarted with 0.0 instead of repeat it.
Here is the logging output :
I/flutter (14250): progress : 0.011378200000000005
I/flutter (14250): progress : 0.008043799999999934
I/flutter (14250): progress : 0.004709100000000022
I/flutter (14250): progress : 0.0013756000000000324
I/flutter (14250): Reload
I/flutter (14250): progress : 0.0
What am I doing wrong ?