Closed cjl84914 closed 9 months ago
Can you try using callback
instead of value
in the delegate.
example:
ValueDelegate.gradientColor(
const ['灯光', '灯光', 'Gradient Fill 2'],
callback: (_) => [colorList[i], Colors.white],
),
Let me know if it helps.
@xvrh I try to replace this code:
ValueDelegate.gradientColor(
const ['灯光', '灯光', 'Gradient Fill 2'],
callback: (_) => [colorList[i], Colors.white],
),
but it can not helps.
It seems there is a bug in the update of the gradient. In the mean time to unblock you, you can set a key in the Lottie widget like this:
@override
Widget build(BuildContext context) {
return Lottie.asset(
'assets/blub.json',
key: ValueKey(i),
delegates: LottieDelegates(
text: (initialText) => '**$initialText**',
values: [
ValueDelegate.color(
const ['灯泡', '灯泡', '填充 1'],
value: colorList[i],
),
ValueDelegate.gradientColor(
const ['灯台', '灯台', 'Gradient Fill 1'],
value: [Colors.black, Colors.grey],
),
ValueDelegate.gradientColor(
const ['灯光', '灯光', 'Gradient Fill 2'],
value: [colorList[i], Colors.white],
),
],
),
);
}
@xvrh Thank you! It is helpful that set a key.
bulb.json
flutter code:
I used lottie 2.7.0, I try continuously refresh bulb light color, but ValueDelegate.gradientColor not working.