SpriteAnimationWidget.asset constructor

SpriteAnimationWidget.asset({
  1. required String path,
  2. required SpriteAnimationData data,
  3. Images? images,
  4. bool playing = true,
  5. Anchor anchor = Anchor.topLeft,
  6. WidgetBuilder? errorBuilder,
  7. WidgetBuilder? loadingBuilder,
  8. VoidCallback? onComplete,
  9. Key? key,
})

Loads image from the asset path and renders it as a widget.

It will use the loadingBuilder while the image from path is loading. To render without loading, or when you want to have a gapless playback when the path value changes, consider loading the SpriteAnimation beforehand and direct pass it to the default constructor.

Implementation

SpriteAnimationWidget.asset({
  required String path,
  required SpriteAnimationData data,
  Images? images,
  this.playing = true,
  this.anchor = Anchor.topLeft,
  this.errorBuilder,
  this.loadingBuilder,
  this.onComplete,
  super.key,
})  : _animationFuture = SpriteAnimation.load(path, data, images: images),
      _animationTicker = null;