mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-07-09 19:55:25 +08:00
Working on nnbd.
This commit is contained in:
example/lib
lib
rive.dartrive.dartrive_file.dartrive_render_box.dartruntime_artboard.dartstate_machine_controller.dart
pubspec.yamlsrc
controllers
core
extensions.dartgenerated
animation
animation_base.dartanimation_state_base.dartcubic_interpolator_base.dartkeyed_object_base.dartkeyed_property_base.dartkeyframe_base.dartkeyframe_color_base.dartkeyframe_double_base.dartkeyframe_draw_order_base.dartkeyframe_draw_order_value_base.dartkeyframe_id_base.dartlinear_animation_base.dartstate_machine_bool_base.dartstate_machine_component_base.dartstate_machine_double_base.dartstate_transition_base.darttransition_condition_base.darttransition_double_condition_base.darttransition_value_condition_base.dart
artboard_base.dartbones
bone_base.dartcubic_weight_base.dartroot_bone_base.dartskin_base.darttendon_base.dartweight_base.dart
component_base.dartdraw_rules_base.dartdraw_target_base.dartdrawable_base.dartnode_base.dartrive_core_context.dartshapes
clipping_shape_base.dartcubic_asymmetric_vertex_base.dartcubic_detached_vertex_base.dartcubic_mirrored_vertex_base.dart
transform_component_base.dartpaint
fill_base.dartgradient_stop_base.dartlinear_gradient_base.dartshape_paint_base.dartsolid_color_base.dartstroke_base.darttrim_path_base.dart
parametric_path_base.dartpath_base.dartpath_vertex_base.dartpoints_path_base.dartpolygon_base.dartrectangle_base.dartstar_base.dartstraight_vertex_base.dartrive_core
animation
animation.dartanimation_state.dartcubic_interpolator.dartkeyed_object.dartkeyed_property.dartkeyframe.dartkeyframe_color.dartkeyframe_double.dartkeyframe_id.dartlayer_state.dartlinear_animation.dartstate_machine_component.dartstate_machine_input.dartstate_machine_layer.dartstate_transition.darttransition_condition.darttransition_double_condition.dart
artboard.dartbackboard.dartbones
component.dartcontainer_component.dartdraw_rules.dartdraw_target.dartdrawable.dartmath
node.dartruntime
shapes
clipping_shape.dartcubic_asymmetric_vertex.dartcubic_detached_vertex.dartcubic_mirrored_vertex.dartcubic_vertex.dart
state_machine_controller.darttransform_component.dartpaint
fill.dartgradient_stop.dartlinear_gradient.dartshape_paint.dartshape_paint_mutator.dartsolid_color.dartstroke.darttrim_path.darttrim_path_drawing.dart
parametric_path.dartpath.dartpath_composer.dartpath_vertex.dartpoints_path.dartpolygon.dartshape.dartshape_paint_container.dartstar.dartstraight_vertex.dartutilities
test
@ -28,18 +28,16 @@ class _ExampleAnimationState extends State<ExampleAnimation> {
|
||||
// download this. The RiveFile just expects a list of bytes.
|
||||
rootBundle.load('assets/dino.riv').then(
|
||||
(data) async {
|
||||
final file = RiveFile();
|
||||
|
||||
// Load the RiveFile from the binary data.
|
||||
if (file.import(data)) {
|
||||
// The artboard is the root of the animation and gets drawn in the
|
||||
// Rive widget.
|
||||
final artboard = file.mainArtboard;
|
||||
// Add a controller to play back a known animation on the main/default
|
||||
// artboard. We store a reference to it so we can toggle playback.
|
||||
artboard.addController(_controller = SimpleAnimation('Run'));
|
||||
setState(() => _riveArtboard = artboard);
|
||||
}
|
||||
final file = RiveFile.import(data);
|
||||
|
||||
// The artboard is the root of the animation and gets drawn in the
|
||||
// Rive widget.
|
||||
final artboard = file.mainArtboard;
|
||||
// Add a controller to play back a known animation on the main/default
|
||||
// artboard. We store a reference to it so we can toggle playback.
|
||||
artboard.addController(_controller = SimpleAnimation('Run'));
|
||||
setState(() => _riveArtboard = artboard);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -11,10 +11,6 @@ class ExampleStateMachine extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ExampleStateMachineState extends State<ExampleStateMachine> {
|
||||
void _togglePlay() {
|
||||
setState(() => _controller.isActive = !_controller.isActive);
|
||||
}
|
||||
|
||||
/// Tracks if the animation is playing by whether controller is running.
|
||||
bool get isPlaying => _controller?.isActive ?? false;
|
||||
|
||||
@ -31,22 +27,20 @@ class _ExampleStateMachineState extends State<ExampleStateMachine> {
|
||||
// download this. The RiveFile just expects a list of bytes.
|
||||
rootBundle.load('assets/rocket.riv').then(
|
||||
(data) async {
|
||||
final file = RiveFile();
|
||||
|
||||
// Load the RiveFile from the binary data.
|
||||
if (file.import(data)) {
|
||||
// The artboard is the root of the animation and gets drawn in the
|
||||
// Rive widget.
|
||||
final artboard = file.mainArtboard;
|
||||
var controller =
|
||||
StateMachineController.fromArtboard(artboard, 'Button');
|
||||
if (controller != null) {
|
||||
artboard.addController(controller);
|
||||
_hoverInput = controller.findInput('Hover');
|
||||
_pressInput = controller.findInput('Press');
|
||||
}
|
||||
setState(() => _riveArtboard = artboard);
|
||||
final file = RiveFile.import(data);
|
||||
|
||||
// The artboard is the root of the animation and gets drawn in the
|
||||
// Rive widget.
|
||||
final artboard = file.mainArtboard;
|
||||
var controller =
|
||||
StateMachineController.fromArtboard(artboard, 'Button');
|
||||
if (controller != null) {
|
||||
artboard.addController(controller);
|
||||
_hoverInput = controller.findInput('Hover');
|
||||
_pressInput = controller.findInput('Press');
|
||||
}
|
||||
setState(() => _riveArtboard = artboard);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user