ensure new value applied.

master
DebuggerX 3 years ago
parent 390f882ea9
commit ed9918f183

@ -106,23 +106,26 @@ class _RingIndicatorState extends State<RingIndicator> {
ticker = Ticker((_) {
var diff = DateTime.now().difference(startTime).inMilliseconds;
if (diff > 300) {
_applyChangeToSelfAndParent(newValue);
return ticker?.stop();
}
if (mounted) {
setState(() {
_value = oldValue + (newValue - oldValue) * (diff / 300);
values[0] = LevelValue(_value);
});
if (parent != null) {
for (var value in values.values) {
parent!.updateValue(value.incrementLevel());
}
}
}
_applyChangeToSelfAndParent(oldValue + (newValue - oldValue) * (diff / 300));
})
..start();
}
_applyChangeToSelfAndParent(double value) {
setState(() {
_value = value;
values[0] = LevelValue(_value);
});
if (parent != null) {
for (var value in values.values) {
parent!.updateValue(value.incrementLevel());
}
}
}
@override
void initState() {
super.initState();

Loading…
Cancel
Save