【问题标题】:Lottie animation glitch - FlutterLottie 动画故障 - Flutter
【发布时间】:2022-10-23 17:13:57
【问题描述】:

我有一个非常简单的动画,用于我在 Adob​​e After Effects 中制作并通过 LottieFiles 扩展名将其导出为 json 的摇动 jar 的闪屏,它工作正常,但是当我打开应用程序时每隔几次动画就会出现故障(见下图),我想不通,并尝试寻找解决方案但没有成功。问题是故障是随机发生的(有时当我打开应用程序时会连续发生几次,有时是每 x 次)。这是在多个安卓设备上测试的,结果相同。

启动画面代码:

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: isDarkMode()? const Color(0xFF31302f) : const Color(0xFFfcfaf6),
      body:
          Align(
            alignment: Alignment.topCenter,
            child: Column(
              children: [
                SizedBox(height: height(context)*0.08),
                Stack(
                  children: [
                    Image.asset(
                      isDarkMode()? 'assets/crnikruh.png' : 'assets/bijelikruh.png',
                      height: height(context)*0.3,
                      width: height(context)*0.3,
                    ),
                    Padding(
                      padding: EdgeInsets.only(top: height(context)*0.01),
                      child: Lottie.asset(
                        'lottie/jaranimation.json',
                        width: height(context)*0.3,
                        height: height(context)*0.3,
                        frameRate: FrameRate.max,
                        fit: BoxFit.fill,
                      ),
                    )
                  ],
                ),
            ],
         ),
       ),
    );
  }
}

This is the normal view

This is the animation with the problem

【问题讨论】:

    标签: android flutter dart lottie


    【解决方案1】:

    我找到了解决此问题的方法。这不是解决方案,但它有效。所以,我认为问题在于它每次都没有正确加载,帮助我的技巧是我用可见性小部件包装了 lottie 资产并将可见性延迟了 50 毫秒,所以它在启动时得到了额外的 50 毫秒才能正确加载资产。

    【讨论】:

      猜你喜欢
      • 2023-02-17
      • 1970-01-01
      • 2022-09-27
      • 2019-08-16
      • 2014-11-24
      • 2013-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多