SpriteAnimationWidget.asset constructor
SpriteAnimationWidget.asset({
- required String path,
- required SpriteAnimationData data,
- Images? images,
- bool playing = true,
- Anchor anchor = Anchor.topLeft,
- WidgetBuilder? errorBuilder,
- WidgetBuilder? loadingBuilder,
- VoidCallback? onComplete,
- Paint? paint,
- 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,
this.paint,
super.key,
}) : _animationFuture = SpriteAnimation.load(path, data, images: images),
_animationTicker = null;