flutterflutter-animationlottieandroid-lottie

Lottie files not showing/rendering properly in flutter


When using Lottie files on flutter, it seems to change the way it looks.

Container(
  child: Lottie.asset('assets/animations/location_lottie.json'),
)

This is how its supposed to look:

This is how it turned out in the app:

Tried downgrading lottie, tried with different files, but it's just like that only..


Solution

  • To everyone facing the similar issue, it has already been raised in github and the problem basically occurs due to issue with the rendering of the lottie files. The rendering issue arises when you choose a custom color for the lottie file.

    So, I've just found a temporary workaround for the issue, the issue basically arises whenever you're using a custom-colored JSON file. Instead, download the original file, and manually edit the JSON file to change the color.

    How to edit:

    In a lottie file this is how color is structured in a lottie file:

    {
    "ty": "fl",
    "nm": "Fill",
    "o": {
        "a": 0,
        "k": 100
    },
    "c": {
        "a": 0,
        "k": [
            0.710,
            0.192,
            0.278
        ]
    },
    "r": 1
    

    The above steps actually worked for me, thanks to gpt for breaking the json down.