RiveWidgetController class base

This controller builds on top of the concept of a Rive painter, but provides a more convenient API for building Rive widgets.

To be used with RiveWidget and RiveWidgetBuilder widgets.

Inheritance
Mixed-in types
Available extensions

Constructors

RiveWidgetController(File file, {ArtboardSelector artboardSelector = const ArtboardDefault(), StateMachineSelector stateMachineSelector = const StateMachineDefault(), DataBind? main, Map<String, DataBind> globals = const {}})
This controller builds on top of the concept of a Rive painter, but provides a more convenient API for building Rive widgets.

Properties

active ↔ bool
getter/setter pair
alignment ↔ Alignment
Controls how the artboard is aligned within its bounds.
getter/setter pairinherited
artboard ↔ Artboard
The artboard that the RiveWidgetController is painting.
latefinaloverride-getter
cursor ↔ MouseCursor
The cursor to use when the pointer is over the hit test area.
getter/setter pairinherited
file → File
The Rive file to this controller is built from.
final
fit ↔ Fit
Controls how the artboard is scaled and positioned within its bounds.
getter/setter pairinherited
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hitTestBehavior ↔ RiveHitTestBehavior
The hit test behavior to use when determining if a pointer event occurred within the widget's bounds and to check if a hit occurred on a Rive listener.
getter/setter pairinherited
isSemanticsEnabled → bool
Whether semantic tree tracking is currently enabled.
no setterinherited
isTickerActive → bool
Whether the animation ticker is currently active.
no setterinherited
lastSize → Size
no setterinherited
layoutScaleFactor ↔ double
The scale factor to use for a fit of type Fit.layout.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticsEnabled ← bool
Enable or disable semantic tree tracking.
no getterinherited
semanticsStateMachine → StateMachine?
The state machine to query for semantic diffs.
no setter
semanticTree → SemanticTreeModel?
The semantic tree model, updated each frame by updateSemantics. Null until semanticsEnabled is set to true.
no setterinherited
size → Size
no setterinherited
stateMachine ↔ StateMachine
The state machine that the RiveWidgetController is using.
latefinaloverride-getter
viewModelInstance → ViewModelInstance?
The bound main view model instance, or null if nothing is bound. Reads are live - they always reflect what is currently bound - and reading the same thing twice returns the same object.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
advance(double elapsedSeconds) → bool
Called each frame to advance the animation.
override
artboardChanged(Artboard artboard) → void
Called when the underlying artboard changes.
override
bind({DataBind? main, Map<String, DataBind> globals = const {}}) → void
Binds view model instances to the state machine. However many instances you set, the expensive rebind runs exactly once.
dataBind(DataBind dataBind) → BindableViewModelInstance

Available on RiveWidgetController, provided by the RiveLegacyControllerDataBind extension

Resolves dataBind against the artboard's default view model and binds it as the main view model instance, immediately, with the removed dataBind method's ownership contract: the caller owns the returned instance and is responsible for disposing it.
dispatchPointerEvent(StateMachine stateMachine, PointerEvent event, Vec2D position) → HitResult
Dispatches a Flutter PointerEvent to stateMachine, mapping it to the matching state machine pointer call(s) and returning the resulting rive.HitResult.
inherited
dispatchScrollEvent(StateMachine stateMachine, PointerEvent event, Vec2D position, Vec2D delta) → HitResult
Dispatches indirect scroll input to stateMachine. Flutter reports real phases, so this host sends rive.ScrollPhase.end on release and lets the runtime's physics own the fling.
inherited
dispose() → void
Discards any resources used by the object.
override
disposeSemantics() → void
Dispose the semantic tree. Call from your painter's dispose method.
inherited
globalViewModelInstance(String name) → ViewModelInstance?
The instance bound for the global view model name, or null if nothing is bound for it or the name is not a global view model. Reads are live, same object per slot.
hitTest(Offset position) → bool
Determine if a pointer event occurred within the widget's bounds and to check if a hit occurred on a Rive listener.
override
localDeltaToArtboard({required Offset delta, required AABB artboardBounds, required Fit fit, required Alignment alignment, required Size size, double scaleFactor = RiveDefaults.layoutScaleFactor}) → Vec2D
Maps a local-space delta into artboard space: localToArtboard with the translation dropped, since a delta is a vector.
inherited
localToArtboard({required Offset position, required AABB artboardBounds, required Fit fit, required Alignment alignment, required Size size, double scaleFactor = RiveDefaults.layoutScaleFactor}) → Vec2D
Convert a local offset to the artboard coordinate space.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
paint(Renderer renderer, Size size, double paintPixelRatio) → void
Called each frame to paint the artboard.
inherited
pointerEvent(PointerEvent event, HitTestEntry<HitTestTarget> entry) → void
Handle a pointer event.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resetSemanticTree() → void
Clear the semantic tree. Call whenever semanticsStateMachine is replaced: node ids restart at 1 per state machine, so stale nodes from the previous machine would collide with the new machine's diff stream.
inherited
scheduleRepaint() → void
Request a repaint of the artboard.
override
toString() → String
A string representation of this object.
inherited
updateSemantics() → void
Query the state machine for semantic diffs and apply them to semanticTree. Call this from your advance method after advancing the animation.
inherited

Operators

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