Merge pull request #115 from tbm98/master

Add placeHolder widget to RiveAnimation
This commit is contained in:
Matt Sullivan
2021-06-09 16:34:43 -07:00
committed by GitHub

View File

@ -21,6 +21,8 @@ class RiveAnimation extends StatefulWidget {
final String? animation;
final BoxFit? fit;
final Alignment? alignment;
/// Widget displayed while the rive is loading.
final Widget? placeHolder;
/// Creates a new RiveAnimation from an asset bundle
const RiveAnimation.asset(
@ -29,6 +31,7 @@ class RiveAnimation extends StatefulWidget {
this.animation,
this.fit,
this.alignment,
this.placeHolder,
}) : src = _Source.asset;
const RiveAnimation.network(
@ -37,6 +40,7 @@ class RiveAnimation extends StatefulWidget {
this.animation,
this.fit,
this.alignment,
this.placeHolder,
}) : src = _Source.network;
@override
@ -129,5 +133,5 @@ class _RiveAnimationState extends State<RiveAnimation> {
fit: widget.fit,
alignment: widget.alignment,
)
: const SizedBox();
: widget.placeHolder ?? const SizedBox();
}