Giter Club home page Giter Club logo

Unhandled Exception: 'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 772 pos 7: '_ticker != null': AnimationController.stop() called after AnimationController.dispose() about svgaplayer-flutter HOT 7 OPEN

zboboan avatar zboboan commented on August 13, 2024
Unhandled Exception: 'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 772 pos 7: '_ticker != null': AnimationController.stop() called after AnimationController.dispose()

from svgaplayer-flutter.

Comments (7)

PonyCui avatar PonyCui commented on August 13, 2024

错误信息已经很明确了

from svgaplayer-flutter.

zboboan avatar zboboan commented on August 13, 2024

错误信息已经很明确了
dispose 后调用了 stop 不知道为什么会这样,试了很多方法都不行

from svgaplayer-flutter.

zboboan avatar zboboan commented on August 13, 2024

错误信息已经很明确了

一个页面有多个 SVGA 就会这样,希望可以优化

from svgaplayer-flutter.

PonyCui avatar PonyCui commented on August 13, 2024

可以给一份有问题的 Demo 代码不?

from svgaplayer-flutter.

zboboan avatar zboboan commented on August 13, 2024

可以给一份有问题的 Demo 代码不?

/// 图片优化封装====================================
class ImagePath {
  ///svga动画
  static Widget loadingSVGA() {
    return const SizedBox(
      width: 20,
      height: 20,
      child: SvgaAnimat(file: "assets/svga/abc.svga"),
    );
  }

  ///下载图片后缓存图片  cached_network_image
  static Widget network(String? imageUrl, {Size? size, BoxFit? fit}) {
    return imageUrl != null
        ? CachedNetworkImage(
            imageUrl: imageUrl,
            width: size?.width ?? double.infinity,
            height: size?.height ?? double.infinity,
            fit: fit ?? BoxFit.cover,
            placeholder: (context, url) {
              return SizedBox(
                width: size?.width ?? double.infinity,
                height: size?.height ?? double.infinity,
                child: loadingSVGA(),  //使用 SVGA  在图片加载时有一个 loading 的动画
              );
            },
            errorWidget: (context, url, error) => Container(
              color: const Color(0xffF1F8FF),
              width: size?.width ?? double.infinity,
              height: size?.height ?? double.infinity,
              child: const Icon(
                Icons.image,
                color: Color(0xffD3E2F5),
              ),
            ),
          )
        : Container(
            color: const Color(0xffF1F8FF),
            width: size?.width ?? double.infinity,
            height: size?.height ?? double.infinity,
            child: const Icon(
              Icons.image,
              color: Color(0xffD3E2F5),
            ),
          );
  }
}

/// 页面应用 ===================================

List<Widget> _likeList() {
    // 猜你喜欢
    var tiem = hotProductList!.map((val) {
      String pic = Setting.serviceUrl + '/' + val.pic!.replaceAll('\\', '/');
      return Column(
        children: [
          Container(
            width: ScreenutilSize().width(120.0),
            height: ScreenutilSize().height(120.0),
            margin: EdgeInsets.only(right: ScreenutilSize().width(20.0)),
            child: ImagePath.network(pic),   // 后台读取数据 循环出来就会报错  
          ),
          SizedBox(
            width: ScreenutilSize().width(120.0),
            child: Text(
              val.title!,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                fontSize: ScreenutilSize().fontSize(20),
              ),
            ),
          ),
        ],
      );
    });
    return tiem.toList();
  }

from svgaplayer-flutter.

sevenvip avatar sevenvip commented on August 13, 2024

同样问题 也是多个svga

from svgaplayer-flutter.

PonyCui avatar PonyCui commented on August 13, 2024

无法重现

from svgaplayer-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.