flutter Lottie动画问题

发布于 2025-01-13 16:17:53 字数 98 浏览 2 评论 0原文

我在我的 flutter 应用程序中使用 Lottie 动画。我收到一条错误消息“使用 JsonReader.setLenient(true) 接受路径 $ 处格式错误的 JSON”

I am using Lottie animation in my flutter app . I got a error saying that "Use JsonReader.setLenient(true) to accept malformed JSON at path $

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆离笙 2025-01-20 16:17:53

就我而言,我更新了lottie的版本,我还发现下载json格式的lottie更好。

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

结果:

在此处输入图像描述

行内有抽奖

我希望它有帮助

In my case I updated the version of lottie, and I also found it better to download lottie in json format.

dependencies:
  flutter:
    sdk: flutter
  lottie: ^2.4.0

and in assets like this:

  assets:
    - assets/lottie/

the code call lottie:

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

OBS: SimpleShadow() is a library

dependencies:
  simple_shadow: ^0.3.1

Result:

enter image description here

Inside the line are lotties

I hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文