SpriteWidget.asset constructor
SpriteWidget.asset({
- required String path,
- Images? images,
- Anchor anchor = Anchor.topLeft,
- double angle = 0,
- Vector2? srcPosition,
- Vector2? srcSize,
- WidgetBuilder? errorBuilder,
- WidgetBuilder? loadingBuilder,
- Paint? paint,
- Key? key,
Load the 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 image beforehand
and direct pass it to the default constructor.
Implementation
SpriteWidget.asset({
required String path,
Images? images,
this.anchor = Anchor.topLeft,
this.angle = 0,
Vector2? srcPosition,
Vector2? srcSize,
this.errorBuilder,
this.loadingBuilder,
this.paint,
super.key,
}) : _spriteFuture = Sprite.load(
path,
srcSize: srcSize,
srcPosition: srcPosition,
images: images,
);