Git Product home page Git Product logo

Comments (4)

xvrh avatar xvrh commented on June 3, 2024

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.

from lottie-flutter.

cjl84914 avatar cjl84914 commented on June 3, 2024

@xvrh
I try to replace this code:

ValueDelegate.gradientColor(
  const ['灯光', '灯光', 'Gradient Fill 2'],
  callback: (_) => [colorList[i], Colors.white],
),

but it can not helps.

from lottie-flutter.

xvrh avatar xvrh commented on June 3, 2024

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],
          ),
        ],
      ),
    );
  }

from lottie-flutter.

cjl84914 avatar cjl84914 commented on June 3, 2024

@xvrh
Thank you! It is helpful that set a key.

from lottie-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.