Flutter Lottie动画问题

3

我在我的Flutter应用程序中使用Lottie动画,但是遇到了一个错误,提示“使用JsonReader.setLenient(true)接受路径$处的格式不正确的JSON”


add your code and lottie json - lava
从这些少量信息中我能理解的是,你的lottie动画json文件不正确(格式错误)。 - Yash Garg
你目前使用哪个包来渲染你的Lottie动画? - Vandad Nahavandipoor
https://pub.dev/packages/lottie - Melvin
嘿,这个问题解决了吗? - Arnvfx
1个回答

0
在我的情况下,我更新了lottie的版本,并且我发现将lottie以json格式下载更好。
dependencies:
  flutter:
    sdk: flutter
  lottie: ^2.4.0

并在像这样的资产中:

  assets:
    - assets/lottie/

代码调用lottie:

Positioned(
  top: size.height * 0.05,
  child: SizedBox(
    height: 200,
    child: SimpleShadow(
      child: Lottie.asset('assets/lottie/lottie-file.json'),
    )),
),

OBS: SimpleShadow() 是一个库

dependencies:
  simple_shadow: ^0.3.1

结果:

enter image description here

线内有小玩偶

希望能帮到你


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接