SpineWidget.fromAsset constructor
- String? _atlasFile,
- String? _skeletonFile,
- SpineWidgetController _controller, {
- AssetBundle? bundle,
- BoxFit? fit,
- Alignment? alignment,
- BoundsProvider? boundsProvider,
- bool? sizedByBounds,
- Key? key,
Constructs a new SpineWidget from files in the root bundle or the optionally specified bundle
. The _atlasFile
specifies the
.atlas
file to be loaded for the images used to render the skeleton. The _skeletonFile
specifies either a Skeleton .json
or
.skel
file containing the skeleton data.
After initialization is complete, the provided _controller
is invoked as per the SpineWidgetController semantics, to allow
modifying how the skeleton inside the widget is animated and rendered.
The skeleton is fitted and aligned inside the widget as per the fit
and alignment
arguments. For this purpose, the skeleton
bounds must be computed via a BoundsProvider. By default, BoxFit.contain, Alignment.center, and a SetupPoseBounds provider
are used.
The widget can optionally by sized by the bounds provided by the BoundsProvider by passing true
for sizedByBounds
.
Implementation
SpineWidget.fromAsset(this._atlasFile, this._skeletonFile, this._controller,
{AssetBundle? bundle, BoxFit? fit, Alignment? alignment, BoundsProvider? boundsProvider, bool? sizedByBounds, super.key})
: _assetType = _AssetType.asset,
_fit = fit ?? BoxFit.contain,
_alignment = alignment ?? Alignment.center,
_boundsProvider = boundsProvider ?? const SetupPoseBounds(),
_sizedByBounds = sizedByBounds ?? false,
_drawable = null,
_bundle = bundle ?? rootBundle;