RiveAnimation class

High level widget that plays an animation from a Rive file. If artboard or animation are not specified, the default artboard and first animation found within it are used.

Inheritance

Constructors

RiveAnimation.asset(String asset, {String? artboard, List<String> animations = const [], List<String> stateMachines = const [], BoxFit? fit, Alignment? alignment, Widget? placeHolder, bool antialiasing = true, bool useArtboardSize = false, Rect? clipRect, List<RiveAnimationController> controllers = const [], OnInitCallback? onInit, RiveHitTestBehavior behavior = RiveHitTestBehavior.opaque, ObjectGenerator? objectGenerator, Key? key})
Creates a new RiveAnimation from an asset bundle.
const
RiveAnimation.direct(RiveFile file, {String? artboard, List<String> animations = const [], List<String> stateMachines = const [], BoxFit? fit, Alignment? alignment, Widget? placeHolder, bool antialiasing = true, bool useArtboardSize = false, Rect? clipRect, List<RiveAnimationController> controllers = const [], OnInitCallback? onInit, Key? key, RiveHitTestBehavior behavior = RiveHitTestBehavior.opaque})
Creates a new RiveAnimation from a direct RiveFile object
const
RiveAnimation.file(String path, {String? artboard, List<String> animations = const [], List<String> stateMachines = const [], BoxFit? fit, Alignment? alignment, Widget? placeHolder, bool antialiasing = true, bool useArtboardSize = false, Rect? clipRect, List<RiveAnimationController> controllers = const [], OnInitCallback? onInit, RiveHitTestBehavior behavior = RiveHitTestBehavior.opaque, ObjectGenerator? objectGenerator, Key? key})
Creates a new RiveAnimation from a local .riv file
const
RiveAnimation.network(String url, {String? artboard, List<String> animations = const [], List<String> stateMachines = const [], BoxFit? fit, Alignment? alignment, Widget? placeHolder, bool antialiasing = true, bool useArtboardSize = false, Rect? clipRect, List<RiveAnimationController> controllers = const [], OnInitCallback? onInit, Map<String, String>? headers, RiveHitTestBehavior behavior = RiveHitTestBehavior.opaque, ObjectGenerator? objectGenerator, Key? key})
Creates a new RiveAnimation from a URL over HTTP
const

Properties

alignment Alignment?
Alignment for the animation in the widget
final
animations List<String>
List of animations to play; default animation if not specified
final
antialiasing bool
Enable/disable antialiasing when rendering
final
artboard String?
The name of the artboard to use; default artboard if not specified
final
behavior RiveHitTestBehavior
How to behave during hit testing to consider targets behind this animation.
final
clipRect Rect?
Clip the artboard to this rect.
final
controllers List<RiveAnimationController>
Controllers for instanced animations and state machines; use this to directly control animation states instead of passing names.
final
file RiveFile?
The Rive File object
final
fit BoxFit?
Fit for the animation in the widget
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Headers for network requests
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
name String?
The asset name or url
final
objectGenerator ObjectGenerator?
Rive object generator to override built-in types and methods to, for example, interject custom rendering functionality interleaved with Rive rendering.
final
onInit OnInitCallback?
Callback fired when RiveAnimation has initialized
final
placeHolder Widget?
Widget displayed while the rive is loading
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
src → _Source
The type of source used to retrieve the asset
final
stateMachines List<String>
List of state machines to play; none will play if not specified
final
useArtboardSize bool
Determines whether to use the inherent size of the artboard, i.e. the absolute size defined by the artboard, or size the widget based on the available constraints only (sized by parent).
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() RiveAnimationState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited