mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[flutter] Support hot-reload of SpineWidget and controller.
This commit is contained in:
parent
4ea0205a27
commit
425e5a5f2c
@ -373,6 +373,18 @@ class _SpineWidgetState extends State<SpineWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant SpineWidget oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
widget._controller._drawable?.dispose();
|
||||
_drawable = null;
|
||||
if (widget._assetType == _AssetType.drawable) {
|
||||
loadDrawable(widget._drawable!);
|
||||
} else {
|
||||
loadFromAsset(widget._bundle, widget._atlasFile!, widget._skeletonFile!, widget._assetType);
|
||||
}
|
||||
}
|
||||
|
||||
void loadDrawable(SkeletonDrawable drawable) {
|
||||
_drawable = drawable;
|
||||
_computedBounds = widget._boundsProvider.computeBounds(drawable);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user