Cannot manage to restart my animation despite the setState()
.
My code as follows:
class SocOptimiserProgressIndicator extends StatefulWidget {
@override
State<SocOptimiserProgressIndicator> createState() =>
_SocOptimiserProgressIndicatorState();
}
class _SocOptimiserProgressIndicatorState
extends State<SocOptimiserProgressIndicator> {
double _start = 0;
@override
Widget build(BuildContext context) {
final size = 40.0;
return TweenAnimationBuilder<double>(
tween: Tween(begin: _start, end: 1.0),
duration: Duration(seconds: 4),
onEnd: () => setState(() {
_start = 1 - _start;
}),
builder: (context, value, child) {
// percentage to show in Center Text
int percentage = (value * 100).ceil();
// blah blah