diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..292edff --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +test/assets/** filter=lfs diff=lfs merge=lfs -text +test/goldens/**/images/*.png filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/.rive_head b/.rive_head index f35e5cb..a0ae7d5 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -2eb7308d297bd1b829c6aa829df6470823e76671 +96a0f0b967bb6ced28c5f4c5a5616cda22b22944 diff --git a/CHANGELOG.md b/CHANGELOG.md index a6623c9..dfdbc7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ -## Upcoming +## 0.11.14 - Refactor how hit testing is performed in `RiveAnimation` and `Rive` widgets. Pointer events (listeners) can now be enabled on the `Rive` widget by setting `enablePointerEvents` to `true` (default is false). +- Change in how animations advance when using `RiveAnimation` and `Rive` widgets. Now using `Ticker`, which will allow Rive animations to respect `timeDilation` and `TickerMode`. Resolves [187](https://github.com/rive-app/rive-flutter/issues/187), [254](https://github.com/rive-app/rive-flutter/issues/254), [307](https://github.com/rive-app/rive-flutter/issues/307), and [328](https://github.com/rive-app/rive-flutter/issues/328) +- Support for line spacing. ## 0.11.13 diff --git a/lib/src/generated/animation/advanceable_state_base.dart b/lib/src/generated/animation/advanceable_state_base.dart index 8a36272..2fa52f4 100644 --- a/lib/src/generated/animation/advanceable_state_base.dart +++ b/lib/src/generated/animation/advanceable_state_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/advanceable_state_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/state_machine_layer_component_base.dart'; import 'package:rive/src/rive_core/animation/layer_state.dart'; @@ -39,8 +40,10 @@ abstract class AdvanceableStateBase extends LayerState { void speedChanged(double from, double to); @override - void copy(covariant AdvanceableStateBase source) { + void copy(Core source) { super.copy(source); - _speed = source._speed; + if (source is AdvanceableStateBase) { + _speed = source._speed; + } } } diff --git a/lib/src/generated/animation/animation_base.dart b/lib/src/generated/animation/animation_base.dart index 794b61a..f84c441 100644 --- a/lib/src/generated/animation/animation_base.dart +++ b/lib/src/generated/animation/animation_base.dart @@ -36,7 +36,9 @@ abstract class AnimationBase extends Core { void nameChanged(String from, String to); @override - void copy(covariant AnimationBase source) { - _name = source._name; + void copy(Core source) { + if (source is AnimationBase) { + _name = source._name; + } } } diff --git a/lib/src/generated/animation/animation_state_base.dart b/lib/src/generated/animation/animation_state_base.dart index 11242a6..f857df4 100644 --- a/lib/src/generated/animation/animation_state_base.dart +++ b/lib/src/generated/animation/animation_state_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/animation_state_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/layer_state_base.dart'; import 'package:rive/src/generated/animation/state_machine_layer_component_base.dart'; import 'package:rive/src/rive_core/animation/advanceable_state.dart'; @@ -44,8 +45,10 @@ abstract class AnimationStateBase extends AdvanceableState { void animationIdChanged(int from, int to); @override - void copy(covariant AnimationStateBase source) { + void copy(Core source) { super.copy(source); - _animationId = source._animationId; + if (source is AnimationStateBase) { + _animationId = source._animationId; + } } } diff --git a/lib/src/generated/animation/blend_animation_1d_base.dart b/lib/src/generated/animation/blend_animation_1d_base.dart index fbc9939..d15f0a7 100644 --- a/lib/src/generated/animation/blend_animation_1d_base.dart +++ b/lib/src/generated/animation/blend_animation_1d_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/blend_animation_1d_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/blend_animation.dart'; abstract class BlendAnimation1DBase extends BlendAnimation { @@ -35,8 +36,10 @@ abstract class BlendAnimation1DBase extends BlendAnimation { void valueChanged(double from, double to); @override - void copy(covariant BlendAnimation1DBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is BlendAnimation1DBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/blend_animation_base.dart b/lib/src/generated/animation/blend_animation_base.dart index c29c76d..74aadb0 100644 --- a/lib/src/generated/animation/blend_animation_base.dart +++ b/lib/src/generated/animation/blend_animation_base.dart @@ -37,7 +37,9 @@ abstract class BlendAnimationBase extends Core { void animationIdChanged(int from, int to); @override - void copy(covariant BlendAnimationBase source) { - _animationId = source._animationId; + void copy(Core source) { + if (source is BlendAnimationBase) { + _animationId = source._animationId; + } } } diff --git a/lib/src/generated/animation/blend_animation_direct_base.dart b/lib/src/generated/animation/blend_animation_direct_base.dart index bdd1a4a..8ac746f 100644 --- a/lib/src/generated/animation/blend_animation_direct_base.dart +++ b/lib/src/generated/animation/blend_animation_direct_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/blend_animation_direct_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/blend_animation.dart'; abstract class BlendAnimationDirectBase extends BlendAnimation { @@ -87,10 +88,12 @@ abstract class BlendAnimationDirectBase extends BlendAnimation { void blendSourceChanged(int from, int to); @override - void copy(covariant BlendAnimationDirectBase source) { + void copy(Core source) { super.copy(source); - _inputId = source._inputId; - _mixValue = source._mixValue; - _blendSource = source._blendSource; + if (source is BlendAnimationDirectBase) { + _inputId = source._inputId; + _mixValue = source._mixValue; + _blendSource = source._blendSource; + } } } diff --git a/lib/src/generated/animation/blend_state_1d_base.dart b/lib/src/generated/animation/blend_state_1d_base.dart index 63c990c..09c5aa2 100644 --- a/lib/src/generated/animation/blend_state_1d_base.dart +++ b/lib/src/generated/animation/blend_state_1d_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/blend_state_1d_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/layer_state_base.dart'; import 'package:rive/src/generated/animation/state_machine_layer_component_base.dart'; import 'package:rive/src/rive_core/animation/blend_animation_1d.dart'; @@ -44,8 +45,10 @@ abstract class BlendState1DBase extends BlendState { void inputIdChanged(int from, int to); @override - void copy(covariant BlendState1DBase source) { + void copy(Core source) { super.copy(source); - _inputId = source._inputId; + if (source is BlendState1DBase) { + _inputId = source._inputId; + } } } diff --git a/lib/src/generated/animation/blend_state_transition_base.dart b/lib/src/generated/animation/blend_state_transition_base.dart index b96cf34..23409c3 100644 --- a/lib/src/generated/animation/blend_state_transition_base.dart +++ b/lib/src/generated/animation/blend_state_transition_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/blend_state_transition_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/state_machine_layer_component_base.dart'; import 'package:rive/src/rive_core/animation/state_transition.dart'; @@ -42,8 +43,10 @@ abstract class BlendStateTransitionBase extends StateTransition { void exitBlendAnimationIdChanged(int from, int to); @override - void copy(covariant BlendStateTransitionBase source) { + void copy(Core source) { super.copy(source); - _exitBlendAnimationId = source._exitBlendAnimationId; + if (source is BlendStateTransitionBase) { + _exitBlendAnimationId = source._exitBlendAnimationId; + } } } diff --git a/lib/src/generated/animation/cubic_interpolator_base.dart b/lib/src/generated/animation/cubic_interpolator_base.dart index 006ac3f..c8daf91 100644 --- a/lib/src/generated/animation/cubic_interpolator_base.dart +++ b/lib/src/generated/animation/cubic_interpolator_base.dart @@ -100,10 +100,12 @@ abstract class CubicInterpolatorBase extends Core { void y2Changed(double from, double to); @override - void copy(covariant CubicInterpolatorBase source) { - _x1 = source._x1; - _y1 = source._y1; - _x2 = source._x2; - _y2 = source._y2; + void copy(Core source) { + if (source is CubicInterpolatorBase) { + _x1 = source._x1; + _y1 = source._y1; + _x2 = source._x2; + _y2 = source._y2; + } } } diff --git a/lib/src/generated/animation/cubic_interpolator_component_base.dart b/lib/src/generated/animation/cubic_interpolator_component_base.dart index 4708f39..4a8ffb9 100644 --- a/lib/src/generated/animation/cubic_interpolator_component_base.dart +++ b/lib/src/generated/animation/cubic_interpolator_component_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/cubic_interpolator_component_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class CubicInterpolatorComponentBase extends Component { @@ -101,11 +102,13 @@ abstract class CubicInterpolatorComponentBase extends Component { void y2Changed(double from, double to); @override - void copy(covariant CubicInterpolatorComponentBase source) { + void copy(Core source) { super.copy(source); - _x1 = source._x1; - _y1 = source._y1; - _x2 = source._x2; - _y2 = source._y2; + if (source is CubicInterpolatorComponentBase) { + _x1 = source._x1; + _y1 = source._y1; + _x2 = source._x2; + _y2 = source._y2; + } } } diff --git a/lib/src/generated/animation/keyed_object_base.dart b/lib/src/generated/animation/keyed_object_base.dart index 13adc3a..e1b087e 100644 --- a/lib/src/generated/animation/keyed_object_base.dart +++ b/lib/src/generated/animation/keyed_object_base.dart @@ -36,7 +36,9 @@ abstract class KeyedObjectBase extends Core { void objectIdChanged(int from, int to); @override - void copy(covariant KeyedObjectBase source) { - _objectId = source._objectId; + void copy(Core source) { + if (source is KeyedObjectBase) { + _objectId = source._objectId; + } } } diff --git a/lib/src/generated/animation/keyed_property_base.dart b/lib/src/generated/animation/keyed_property_base.dart index 9ddb36a..a7a7deb 100644 --- a/lib/src/generated/animation/keyed_property_base.dart +++ b/lib/src/generated/animation/keyed_property_base.dart @@ -37,7 +37,9 @@ abstract class KeyedPropertyBase extends Core { void propertyKeyChanged(int from, int to); @override - void copy(covariant KeyedPropertyBase source) { - _propertyKey = source._propertyKey; + void copy(Core source) { + if (source is KeyedPropertyBase) { + _propertyKey = source._propertyKey; + } } } diff --git a/lib/src/generated/animation/keyframe_base.dart b/lib/src/generated/animation/keyframe_base.dart index 77c98de..f33c8e0 100644 --- a/lib/src/generated/animation/keyframe_base.dart +++ b/lib/src/generated/animation/keyframe_base.dart @@ -87,9 +87,11 @@ abstract class KeyFrameBase extends Core { void interpolatorIdChanged(int from, int to); @override - void copy(covariant KeyFrameBase source) { - _frame = source._frame; - _interpolationType = source._interpolationType; - _interpolatorId = source._interpolatorId; + void copy(Core source) { + if (source is KeyFrameBase) { + _frame = source._frame; + _interpolationType = source._interpolationType; + _interpolatorId = source._interpolatorId; + } } } diff --git a/lib/src/generated/animation/keyframe_bool_base.dart b/lib/src/generated/animation/keyframe_bool_base.dart index b5a11fb..b07b237 100644 --- a/lib/src/generated/animation/keyframe_bool_base.dart +++ b/lib/src/generated/animation/keyframe_bool_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/keyframe_bool_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/keyframe.dart'; abstract class KeyFrameBoolBase extends KeyFrame { @@ -34,8 +35,10 @@ abstract class KeyFrameBoolBase extends KeyFrame { void valueChanged(bool from, bool to); @override - void copy(covariant KeyFrameBoolBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is KeyFrameBoolBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/keyframe_color_base.dart b/lib/src/generated/animation/keyframe_color_base.dart index 516c68f..8d84710 100644 --- a/lib/src/generated/animation/keyframe_color_base.dart +++ b/lib/src/generated/animation/keyframe_color_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/keyframe_color_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/keyframe.dart'; abstract class KeyFrameColorBase extends KeyFrame { @@ -34,8 +35,10 @@ abstract class KeyFrameColorBase extends KeyFrame { void valueChanged(int from, int to); @override - void copy(covariant KeyFrameColorBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is KeyFrameColorBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/keyframe_double_base.dart b/lib/src/generated/animation/keyframe_double_base.dart index 2c648a4..a51883a 100644 --- a/lib/src/generated/animation/keyframe_double_base.dart +++ b/lib/src/generated/animation/keyframe_double_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/keyframe_double_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/keyframe.dart'; abstract class KeyFrameDoubleBase extends KeyFrame { @@ -34,8 +35,10 @@ abstract class KeyFrameDoubleBase extends KeyFrame { void valueChanged(double from, double to); @override - void copy(covariant KeyFrameDoubleBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is KeyFrameDoubleBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/keyframe_id_base.dart b/lib/src/generated/animation/keyframe_id_base.dart index 171ca1c..e004927 100644 --- a/lib/src/generated/animation/keyframe_id_base.dart +++ b/lib/src/generated/animation/keyframe_id_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/keyframe_id_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/keyframe.dart'; abstract class KeyFrameIdBase extends KeyFrame { @@ -34,8 +35,10 @@ abstract class KeyFrameIdBase extends KeyFrame { void valueChanged(int from, int to); @override - void copy(covariant KeyFrameIdBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is KeyFrameIdBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/keyframe_string_base.dart b/lib/src/generated/animation/keyframe_string_base.dart index 209708c..98c39a9 100644 --- a/lib/src/generated/animation/keyframe_string_base.dart +++ b/lib/src/generated/animation/keyframe_string_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/keyframe_string_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/keyframe.dart'; abstract class KeyFrameStringBase extends KeyFrame { @@ -34,8 +35,10 @@ abstract class KeyFrameStringBase extends KeyFrame { void valueChanged(String from, String to); @override - void copy(covariant KeyFrameStringBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is KeyFrameStringBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/linear_animation_base.dart b/lib/src/generated/animation/linear_animation_base.dart index 1c05ad8..61cfdd7 100644 --- a/lib/src/generated/animation/linear_animation_base.dart +++ b/lib/src/generated/animation/linear_animation_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/linear_animation_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/animation.dart'; abstract class LinearAnimationBase extends Animation { @@ -208,15 +209,17 @@ abstract class LinearAnimationBase extends Animation { void quantizeChanged(bool from, bool to); @override - void copy(covariant LinearAnimationBase source) { + void copy(Core source) { super.copy(source); - _fps = source._fps; - _duration = source._duration; - _speed = source._speed; - _loopValue = source._loopValue; - _workStart = source._workStart; - _workEnd = source._workEnd; - _enableWorkArea = source._enableWorkArea; - _quantize = source._quantize; + if (source is LinearAnimationBase) { + _fps = source._fps; + _duration = source._duration; + _speed = source._speed; + _loopValue = source._loopValue; + _workStart = source._workStart; + _workEnd = source._workEnd; + _enableWorkArea = source._enableWorkArea; + _quantize = source._quantize; + } } } diff --git a/lib/src/generated/animation/listener_align_target_base.dart b/lib/src/generated/animation/listener_align_target_base.dart index 2fa57ca..9ced41b 100644 --- a/lib/src/generated/animation/listener_align_target_base.dart +++ b/lib/src/generated/animation/listener_align_target_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/listener_align_target_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/listener_action.dart'; abstract class ListenerAlignTargetBase extends ListenerAction { @@ -38,8 +39,10 @@ abstract class ListenerAlignTargetBase extends ListenerAction { void targetIdChanged(int from, int to); @override - void copy(covariant ListenerAlignTargetBase source) { + void copy(Core source) { super.copy(source); - _targetId = source._targetId; + if (source is ListenerAlignTargetBase) { + _targetId = source._targetId; + } } } diff --git a/lib/src/generated/animation/listener_bool_change_base.dart b/lib/src/generated/animation/listener_bool_change_base.dart index 15adf5e..a87c272 100644 --- a/lib/src/generated/animation/listener_bool_change_base.dart +++ b/lib/src/generated/animation/listener_bool_change_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/listener_bool_change_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/listener_action_base.dart'; import 'package:rive/src/rive_core/animation/listener_input_change.dart'; @@ -41,8 +42,10 @@ abstract class ListenerBoolChangeBase extends ListenerInputChange { void valueChanged(int from, int to); @override - void copy(covariant ListenerBoolChangeBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is ListenerBoolChangeBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/listener_fire_event_base.dart b/lib/src/generated/animation/listener_fire_event_base.dart new file mode 100644 index 0000000..b6fa536 --- /dev/null +++ b/lib/src/generated/animation/listener_fire_event_base.dart @@ -0,0 +1,47 @@ +// Core automatically generated +// lib/src/generated/animation/listener_fire_event_base.dart. +// Do not modify manually. + +import 'package:rive/src/core/core.dart'; +import 'package:rive/src/rive_core/animation/listener_action.dart'; + +abstract class ListenerFireEventBase extends ListenerAction { + static const int typeKey = 168; + @override + int get coreType => ListenerFireEventBase.typeKey; + @override + Set get coreTypes => + {ListenerFireEventBase.typeKey, ListenerActionBase.typeKey}; + + /// -------------------------------------------------------------------------- + /// EventId field with key 389. + static const int eventIdInitialValue = -1; + int _eventId = eventIdInitialValue; + static const int eventIdPropertyKey = 389; + + /// Id of the Event referenced. + int get eventId => _eventId; + + /// Change the [_eventId] field value. + /// [eventIdChanged] will be invoked only if the field's value has changed. + set eventId(int value) { + if (_eventId == value) { + return; + } + int from = _eventId; + _eventId = value; + if (hasValidated) { + eventIdChanged(from, value); + } + } + + void eventIdChanged(int from, int to); + + @override + void copy(Core source) { + super.copy(source); + if (source is ListenerFireEventBase) { + _eventId = source._eventId; + } + } +} diff --git a/lib/src/generated/animation/listener_input_change_base.dart b/lib/src/generated/animation/listener_input_change_base.dart index 7106050..ff54f6b 100644 --- a/lib/src/generated/animation/listener_input_change_base.dart +++ b/lib/src/generated/animation/listener_input_change_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/listener_input_change_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/listener_action.dart'; abstract class ListenerInputChangeBase extends ListenerAction { @@ -37,8 +38,10 @@ abstract class ListenerInputChangeBase extends ListenerAction { void inputIdChanged(int from, int to); @override - void copy(covariant ListenerInputChangeBase source) { + void copy(Core source) { super.copy(source); - _inputId = source._inputId; + if (source is ListenerInputChangeBase) { + _inputId = source._inputId; + } } } diff --git a/lib/src/generated/animation/listener_number_change_base.dart b/lib/src/generated/animation/listener_number_change_base.dart index 8254e9d..b51d1fe 100644 --- a/lib/src/generated/animation/listener_number_change_base.dart +++ b/lib/src/generated/animation/listener_number_change_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/listener_number_change_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/listener_action_base.dart'; import 'package:rive/src/rive_core/animation/listener_input_change.dart'; @@ -41,8 +42,10 @@ abstract class ListenerNumberChangeBase extends ListenerInputChange { void valueChanged(double from, double to); @override - void copy(covariant ListenerNumberChangeBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is ListenerNumberChangeBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/nested_bool_base.dart b/lib/src/generated/animation/nested_bool_base.dart index c3cce7e..2f7f8ce 100644 --- a/lib/src/generated/animation/nested_bool_base.dart +++ b/lib/src/generated/animation/nested_bool_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/nested_bool_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/rive_core/animation/nested_input.dart'; @@ -37,8 +38,10 @@ abstract class NestedBoolBase extends NestedInput { void nestedValueChanged(bool from, bool to); @override - void copy(covariant NestedBoolBase source) { + void copy(Core source) { super.copy(source); - _nestedValue = source._nestedValue; + if (source is NestedBoolBase) { + _nestedValue = source._nestedValue; + } } } diff --git a/lib/src/generated/animation/nested_input_base.dart b/lib/src/generated/animation/nested_input_base.dart index ea360a2..7dd7843 100644 --- a/lib/src/generated/animation/nested_input_base.dart +++ b/lib/src/generated/animation/nested_input_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/nested_input_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class NestedInputBase extends Component { @@ -36,8 +37,10 @@ abstract class NestedInputBase extends Component { void inputIdChanged(int from, int to); @override - void copy(covariant NestedInputBase source) { + void copy(Core source) { super.copy(source); - _inputId = source._inputId; + if (source is NestedInputBase) { + _inputId = source._inputId; + } } } diff --git a/lib/src/generated/animation/nested_linear_animation_base.dart b/lib/src/generated/animation/nested_linear_animation_base.dart index 48d4dc0..49f8e55 100644 --- a/lib/src/generated/animation/nested_linear_animation_base.dart +++ b/lib/src/generated/animation/nested_linear_animation_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/nested_linear_animation_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/rive_core/animation/linear_animation.dart'; @@ -45,8 +46,10 @@ abstract class NestedLinearAnimationBase void mixChanged(double from, double to); @override - void copy(covariant NestedLinearAnimationBase source) { + void copy(Core source) { super.copy(source); - _mix = source._mix; + if (source is NestedLinearAnimationBase) { + _mix = source._mix; + } } } diff --git a/lib/src/generated/animation/nested_number_base.dart b/lib/src/generated/animation/nested_number_base.dart index e4ad78a..9b9ed84 100644 --- a/lib/src/generated/animation/nested_number_base.dart +++ b/lib/src/generated/animation/nested_number_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/nested_number_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/rive_core/animation/nested_input.dart'; @@ -40,8 +41,10 @@ abstract class NestedNumberBase extends NestedInput { void nestedValueChanged(double from, double to); @override - void copy(covariant NestedNumberBase source) { + void copy(Core source) { super.copy(source); - _nestedValue = source._nestedValue; + if (source is NestedNumberBase) { + _nestedValue = source._nestedValue; + } } } diff --git a/lib/src/generated/animation/nested_remap_animation_base.dart b/lib/src/generated/animation/nested_remap_animation_base.dart index 1b4eed8..458543c 100644 --- a/lib/src/generated/animation/nested_remap_animation_base.dart +++ b/lib/src/generated/animation/nested_remap_animation_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/nested_remap_animation_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/nested_animation_base.dart'; @@ -45,8 +46,10 @@ abstract class NestedRemapAnimationBase extends NestedLinearAnimation { void timeChanged(double from, double to); @override - void copy(covariant NestedRemapAnimationBase source) { + void copy(Core source) { super.copy(source); - _time = source._time; + if (source is NestedRemapAnimationBase) { + _time = source._time; + } } } diff --git a/lib/src/generated/animation/nested_simple_animation_base.dart b/lib/src/generated/animation/nested_simple_animation_base.dart index 8f9375d..b0f185b 100644 --- a/lib/src/generated/animation/nested_simple_animation_base.dart +++ b/lib/src/generated/animation/nested_simple_animation_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/nested_simple_animation_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/nested_animation_base.dart'; @@ -69,9 +70,11 @@ abstract class NestedSimpleAnimationBase extends NestedLinearAnimation { void isPlayingChanged(bool from, bool to); @override - void copy(covariant NestedSimpleAnimationBase source) { + void copy(Core source) { super.copy(source); - _speed = source._speed; - _isPlaying = source._isPlaying; + if (source is NestedSimpleAnimationBase) { + _speed = source._speed; + _isPlaying = source._isPlaying; + } } } diff --git a/lib/src/generated/animation/state_machine_bool_base.dart b/lib/src/generated/animation/state_machine_bool_base.dart index 5c73c4e..36e3b44 100644 --- a/lib/src/generated/animation/state_machine_bool_base.dart +++ b/lib/src/generated/animation/state_machine_bool_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/state_machine_bool_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/state_machine_component_base.dart'; import 'package:rive/src/rive_core/animation/state_machine_input.dart'; @@ -39,8 +40,10 @@ abstract class StateMachineBoolBase extends StateMachineInput { void valueChanged(bool from, bool to); @override - void copy(covariant StateMachineBoolBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is StateMachineBoolBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/state_machine_component_base.dart b/lib/src/generated/animation/state_machine_component_base.dart index fbfa8ba..74ed6db 100644 --- a/lib/src/generated/animation/state_machine_component_base.dart +++ b/lib/src/generated/animation/state_machine_component_base.dart @@ -38,7 +38,9 @@ abstract class StateMachineComponentBase void nameChanged(String from, String to); @override - void copy(covariant StateMachineComponentBase source) { - _name = source._name; + void copy(Core source) { + if (source is StateMachineComponentBase) { + _name = source._name; + } } } diff --git a/lib/src/generated/animation/state_machine_listener_base.dart b/lib/src/generated/animation/state_machine_listener_base.dart index 4f88110..e0ab06e 100644 --- a/lib/src/generated/animation/state_machine_listener_base.dart +++ b/lib/src/generated/animation/state_machine_listener_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/state_machine_listener_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/state_machine_component.dart'; abstract class StateMachineListenerBase extends StateMachineComponent { @@ -62,9 +63,11 @@ abstract class StateMachineListenerBase extends StateMachineComponent { void listenerTypeValueChanged(int from, int to); @override - void copy(covariant StateMachineListenerBase source) { + void copy(Core source) { super.copy(source); - _targetId = source._targetId; - _listenerTypeValue = source._listenerTypeValue; + if (source is StateMachineListenerBase) { + _targetId = source._targetId; + _listenerTypeValue = source._listenerTypeValue; + } } } diff --git a/lib/src/generated/animation/state_machine_number_base.dart b/lib/src/generated/animation/state_machine_number_base.dart index 531dbb7..413cec4 100644 --- a/lib/src/generated/animation/state_machine_number_base.dart +++ b/lib/src/generated/animation/state_machine_number_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/state_machine_number_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/state_machine_component_base.dart'; import 'package:rive/src/rive_core/animation/state_machine_input.dart'; @@ -39,8 +40,10 @@ abstract class StateMachineNumberBase extends StateMachineInput { void valueChanged(double from, double to); @override - void copy(covariant StateMachineNumberBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is StateMachineNumberBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/state_transition_base.dart b/lib/src/generated/animation/state_transition_base.dart index aa3f7b4..c7ea3e7 100644 --- a/lib/src/generated/animation/state_transition_base.dart +++ b/lib/src/generated/animation/state_transition_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/state_transition_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/state_machine_layer_component.dart'; abstract class StateTransitionBase extends StateMachineLayerComponent { @@ -161,13 +162,15 @@ abstract class StateTransitionBase extends StateMachineLayerComponent { void interpolatorIdChanged(int from, int to); @override - void copy(covariant StateTransitionBase source) { + void copy(Core source) { super.copy(source); - _stateToId = source._stateToId; - _flags = source._flags; - _duration = source._duration; - _exitTime = source._exitTime; - _interpolationType = source._interpolationType; - _interpolatorId = source._interpolatorId; + if (source is StateTransitionBase) { + _stateToId = source._stateToId; + _flags = source._flags; + _duration = source._duration; + _exitTime = source._exitTime; + _interpolationType = source._interpolationType; + _interpolatorId = source._interpolatorId; + } } } diff --git a/lib/src/generated/animation/transition_condition_base.dart b/lib/src/generated/animation/transition_condition_base.dart index 6038428..0a45af8 100644 --- a/lib/src/generated/animation/transition_condition_base.dart +++ b/lib/src/generated/animation/transition_condition_base.dart @@ -36,7 +36,9 @@ abstract class TransitionConditionBase extends Core { void inputIdChanged(int from, int to); @override - void copy(covariant TransitionConditionBase source) { - _inputId = source._inputId; + void copy(Core source) { + if (source is TransitionConditionBase) { + _inputId = source._inputId; + } } } diff --git a/lib/src/generated/animation/transition_number_condition_base.dart b/lib/src/generated/animation/transition_number_condition_base.dart index b051457..9d583c9 100644 --- a/lib/src/generated/animation/transition_number_condition_base.dart +++ b/lib/src/generated/animation/transition_number_condition_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/transition_number_condition_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/animation/transition_condition_base.dart'; import 'package:rive/src/rive_core/animation/transition_value_condition.dart'; @@ -39,8 +40,10 @@ abstract class TransitionNumberConditionBase extends TransitionValueCondition { void valueChanged(double from, double to); @override - void copy(covariant TransitionNumberConditionBase source) { + void copy(Core source) { super.copy(source); - _value = source._value; + if (source is TransitionNumberConditionBase) { + _value = source._value; + } } } diff --git a/lib/src/generated/animation/transition_value_condition_base.dart b/lib/src/generated/animation/transition_value_condition_base.dart index 8a0e8f9..e9fb96b 100644 --- a/lib/src/generated/animation/transition_value_condition_base.dart +++ b/lib/src/generated/animation/transition_value_condition_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/animation/transition_value_condition_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/animation/transition_condition.dart'; abstract class TransitionValueConditionBase extends TransitionCondition { @@ -37,8 +38,10 @@ abstract class TransitionValueConditionBase extends TransitionCondition { void opValueChanged(int from, int to); @override - void copy(covariant TransitionValueConditionBase source) { + void copy(Core source) { super.copy(source); - _opValue = source._opValue; + if (source is TransitionValueConditionBase) { + _opValue = source._opValue; + } } } diff --git a/lib/src/generated/artboard_base.dart b/lib/src/generated/artboard_base.dart index e013d95..aec4924 100644 --- a/lib/src/generated/artboard_base.dart +++ b/lib/src/generated/artboard_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/artboard_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/rive_core/world_transform_component.dart'; @@ -212,15 +213,17 @@ abstract class ArtboardBase extends WorldTransformComponent { void defaultStateMachineIdChanged(int from, int to); @override - void copy(covariant ArtboardBase source) { + void copy(Core source) { super.copy(source); - _clip = source._clip; - _width = source._width; - _height = source._height; - _x = source._x; - _y = source._y; - _originX = source._originX; - _originY = source._originY; - _defaultStateMachineId = source._defaultStateMachineId; + if (source is ArtboardBase) { + _clip = source._clip; + _width = source._width; + _height = source._height; + _x = source._x; + _y = source._y; + _originX = source._originX; + _originY = source._originY; + _defaultStateMachineId = source._defaultStateMachineId; + } } } diff --git a/lib/src/generated/assets/asset_base.dart b/lib/src/generated/assets/asset_base.dart index 69b0334..039ad7a 100644 --- a/lib/src/generated/assets/asset_base.dart +++ b/lib/src/generated/assets/asset_base.dart @@ -35,7 +35,9 @@ abstract class AssetBase extends Core { void nameChanged(String from, String to); @override - void copy(covariant AssetBase source) { - _name = source._name; + void copy(Core source) { + if (source is AssetBase) { + _name = source._name; + } } } diff --git a/lib/src/generated/assets/drawable_asset_base.dart b/lib/src/generated/assets/drawable_asset_base.dart index e0f1920..bd21c43 100644 --- a/lib/src/generated/assets/drawable_asset_base.dart +++ b/lib/src/generated/assets/drawable_asset_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/assets/drawable_asset_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/assets/asset_base.dart'; import 'package:rive/src/rive_core/assets/file_asset.dart'; @@ -62,9 +63,11 @@ abstract class DrawableAssetBase extends FileAsset { void widthChanged(double from, double to); @override - void copy(covariant DrawableAssetBase source) { + void copy(Core source) { super.copy(source); - _height = source._height; - _width = source._width; + if (source is DrawableAssetBase) { + _height = source._height; + _width = source._width; + } } } diff --git a/lib/src/generated/assets/file_asset_base.dart b/lib/src/generated/assets/file_asset_base.dart index 035d134..a1b5a8e 100644 --- a/lib/src/generated/assets/file_asset_base.dart +++ b/lib/src/generated/assets/file_asset_base.dart @@ -85,10 +85,12 @@ abstract class FileAssetBase extends Asset { void cdnBaseUrlChanged(String from, String to); @override - void copy(covariant FileAssetBase source) { + void copy(Core source) { super.copy(source); - _assetId = source._assetId; - _cdnUuid = source._cdnUuid; - _cdnBaseUrl = source._cdnBaseUrl; + if (source is FileAssetBase) { + _assetId = source._assetId; + _cdnUuid = source._cdnUuid; + _cdnBaseUrl = source._cdnBaseUrl; + } } } diff --git a/lib/src/generated/assets/file_asset_contents_base.dart b/lib/src/generated/assets/file_asset_contents_base.dart index 928ff16..8592178 100644 --- a/lib/src/generated/assets/file_asset_contents_base.dart +++ b/lib/src/generated/assets/file_asset_contents_base.dart @@ -36,7 +36,9 @@ abstract class FileAssetContentsBase extends Core { void bytesChanged(Uint8List from, Uint8List to); @override - void copy(covariant FileAssetContentsBase source) { - _bytes = source._bytes; + void copy(Core source) { + if (source is FileAssetContentsBase) { + _bytes = source._bytes; + } } } diff --git a/lib/src/generated/bones/bone_base.dart b/lib/src/generated/bones/bone_base.dart index dc28a35..c799f25 100644 --- a/lib/src/generated/bones/bone_base.dart +++ b/lib/src/generated/bones/bone_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/bones/bone_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/transform_component_base.dart'; @@ -44,8 +45,10 @@ abstract class BoneBase extends SkeletalComponent { void lengthChanged(double from, double to); @override - void copy(covariant BoneBase source) { + void copy(Core source) { super.copy(source); - _length = source._length; + if (source is BoneBase) { + _length = source._length; + } } } diff --git a/lib/src/generated/bones/cubic_weight_base.dart b/lib/src/generated/bones/cubic_weight_base.dart index d2b796a..1daa457 100644 --- a/lib/src/generated/bones/cubic_weight_base.dart +++ b/lib/src/generated/bones/cubic_weight_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/bones/cubic_weight_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/rive_core/bones/weight.dart'; @@ -101,11 +102,13 @@ abstract class CubicWeightBase extends Weight { void outIndicesChanged(int from, int to); @override - void copy(covariant CubicWeightBase source) { + void copy(Core source) { super.copy(source); - _inValues = source._inValues; - _inIndices = source._inIndices; - _outValues = source._outValues; - _outIndices = source._outIndices; + if (source is CubicWeightBase) { + _inValues = source._inValues; + _inIndices = source._inIndices; + _outValues = source._outValues; + _outIndices = source._outIndices; + } } } diff --git a/lib/src/generated/bones/root_bone_base.dart b/lib/src/generated/bones/root_bone_base.dart index 793dadc..f939d7b 100644 --- a/lib/src/generated/bones/root_bone_base.dart +++ b/lib/src/generated/bones/root_bone_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/bones/root_bone_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/bones/skeletal_component_base.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; @@ -72,9 +73,11 @@ abstract class RootBoneBase extends Bone { void yChanged(double from, double to); @override - void copy(covariant RootBoneBase source) { + void copy(Core source) { super.copy(source); - _x = source._x; - _y = source._y; + if (source is RootBoneBase) { + _x = source._x; + _y = source._y; + } } } diff --git a/lib/src/generated/bones/skin_base.dart b/lib/src/generated/bones/skin_base.dart index f6c05d3..808120d 100644 --- a/lib/src/generated/bones/skin_base.dart +++ b/lib/src/generated/bones/skin_base.dart @@ -158,13 +158,15 @@ abstract class SkinBase extends ContainerComponent { void tyChanged(double from, double to); @override - void copy(covariant SkinBase source) { + void copy(Core source) { super.copy(source); - _xx = source._xx; - _yx = source._yx; - _xy = source._xy; - _yy = source._yy; - _tx = source._tx; - _ty = source._ty; + if (source is SkinBase) { + _xx = source._xx; + _yx = source._yx; + _xy = source._xy; + _yy = source._yy; + _tx = source._tx; + _ty = source._ty; + } } } diff --git a/lib/src/generated/bones/tendon_base.dart b/lib/src/generated/bones/tendon_base.dart index d15e366..dae19c5 100644 --- a/lib/src/generated/bones/tendon_base.dart +++ b/lib/src/generated/bones/tendon_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/bones/tendon_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class TendonBase extends Component { @@ -179,14 +180,16 @@ abstract class TendonBase extends Component { void tyChanged(double from, double to); @override - void copy(covariant TendonBase source) { + void copy(Core source) { super.copy(source); - _boneId = source._boneId; - _xx = source._xx; - _yx = source._yx; - _xy = source._xy; - _yy = source._yy; - _tx = source._tx; - _ty = source._ty; + if (source is TendonBase) { + _boneId = source._boneId; + _xx = source._xx; + _yx = source._yx; + _xy = source._xy; + _yy = source._yy; + _tx = source._tx; + _ty = source._ty; + } } } diff --git a/lib/src/generated/bones/weight_base.dart b/lib/src/generated/bones/weight_base.dart index d42aa9f..54f1ca4 100644 --- a/lib/src/generated/bones/weight_base.dart +++ b/lib/src/generated/bones/weight_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/bones/weight_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class WeightBase extends Component { @@ -55,9 +56,11 @@ abstract class WeightBase extends Component { void indicesChanged(int from, int to); @override - void copy(covariant WeightBase source) { + void copy(Core source) { super.copy(source); - _values = source._values; - _indices = source._indices; + if (source is WeightBase) { + _values = source._values; + _indices = source._indices; + } } } diff --git a/lib/src/generated/component_base.dart b/lib/src/generated/component_base.dart index 7292700..3f55b9f 100644 --- a/lib/src/generated/component_base.dart +++ b/lib/src/generated/component_base.dart @@ -60,8 +60,10 @@ abstract class ComponentBase extends Core { void parentIdChanged(int from, int to); @override - void copy(covariant ComponentBase source) { - _name = source._name; - _parentId = source._parentId; + void copy(Core source) { + if (source is ComponentBase) { + _name = source._name; + _parentId = source._parentId; + } } } diff --git a/lib/src/generated/constraints/constraint_base.dart b/lib/src/generated/constraints/constraint_base.dart index a8f3896..83f3a51 100644 --- a/lib/src/generated/constraints/constraint_base.dart +++ b/lib/src/generated/constraints/constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class ConstraintBase extends Component { @@ -36,8 +37,10 @@ abstract class ConstraintBase extends Component { void strengthChanged(double from, double to); @override - void copy(covariant ConstraintBase source) { + void copy(Core source) { super.copy(source); - _strength = source._strength; + if (source is ConstraintBase) { + _strength = source._strength; + } } } diff --git a/lib/src/generated/constraints/distance_constraint_base.dart b/lib/src/generated/constraints/distance_constraint_base.dart index bf81512..4d93a29 100644 --- a/lib/src/generated/constraints/distance_constraint_base.dart +++ b/lib/src/generated/constraints/distance_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/distance_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/rive_core/constraints/targeted_constraint.dart'; @@ -68,9 +69,11 @@ abstract class DistanceConstraintBase extends TargetedConstraint { void modeValueChanged(int from, int to); @override - void copy(covariant DistanceConstraintBase source) { + void copy(Core source) { super.copy(source); - _distance = source._distance; - _modeValue = source._modeValue; + if (source is DistanceConstraintBase) { + _distance = source._distance; + _modeValue = source._modeValue; + } } } diff --git a/lib/src/generated/constraints/follow_path_constraint_base.dart b/lib/src/generated/constraints/follow_path_constraint_base.dart index eb30000..c1133f0 100644 --- a/lib/src/generated/constraints/follow_path_constraint_base.dart +++ b/lib/src/generated/constraints/follow_path_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/follow_path_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/generated/constraints/targeted_constraint_base.dart'; @@ -94,10 +95,12 @@ abstract class FollowPathConstraintBase extends TransformSpaceConstraint { void offsetChanged(bool from, bool to); @override - void copy(covariant FollowPathConstraintBase source) { + void copy(Core source) { super.copy(source); - _distance = source._distance; - _orient = source._orient; - _offset = source._offset; + if (source is FollowPathConstraintBase) { + _distance = source._distance; + _orient = source._orient; + _offset = source._offset; + } } } diff --git a/lib/src/generated/constraints/ik_constraint_base.dart b/lib/src/generated/constraints/ik_constraint_base.dart index f82d09a..da961c2 100644 --- a/lib/src/generated/constraints/ik_constraint_base.dart +++ b/lib/src/generated/constraints/ik_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/ik_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/rive_core/constraints/targeted_constraint.dart'; @@ -71,9 +72,11 @@ abstract class IKConstraintBase extends TargetedConstraint { void parentBoneCountChanged(int from, int to); @override - void copy(covariant IKConstraintBase source) { + void copy(Core source) { super.copy(source); - _invertDirection = source._invertDirection; - _parentBoneCount = source._parentBoneCount; + if (source is IKConstraintBase) { + _invertDirection = source._invertDirection; + _parentBoneCount = source._parentBoneCount; + } } } diff --git a/lib/src/generated/constraints/targeted_constraint_base.dart b/lib/src/generated/constraints/targeted_constraint_base.dart index 8bba274..1ce86d1 100644 --- a/lib/src/generated/constraints/targeted_constraint_base.dart +++ b/lib/src/generated/constraints/targeted_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/targeted_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/rive_core/constraints/constraint.dart'; @@ -42,8 +43,10 @@ abstract class TargetedConstraintBase extends Constraint { void targetIdChanged(int from, int to); @override - void copy(covariant TargetedConstraintBase source) { + void copy(Core source) { super.copy(source); - _targetId = source._targetId; + if (source is TargetedConstraintBase) { + _targetId = source._targetId; + } } } diff --git a/lib/src/generated/constraints/transform_component_constraint_base.dart b/lib/src/generated/constraints/transform_component_constraint_base.dart index cc0dd4c..cb6a157 100644 --- a/lib/src/generated/constraints/transform_component_constraint_base.dart +++ b/lib/src/generated/constraints/transform_component_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/transform_component_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/generated/constraints/targeted_constraint_base.dart'; @@ -216,15 +217,17 @@ abstract class TransformComponentConstraintBase void maxChanged(bool from, bool to); @override - void copy(covariant TransformComponentConstraintBase source) { + void copy(Core source) { super.copy(source); - _minMaxSpaceValue = source._minMaxSpaceValue; - _copyFactor = source._copyFactor; - _minValue = source._minValue; - _maxValue = source._maxValue; - _offset = source._offset; - _doesCopy = source._doesCopy; - _min = source._min; - _max = source._max; + if (source is TransformComponentConstraintBase) { + _minMaxSpaceValue = source._minMaxSpaceValue; + _copyFactor = source._copyFactor; + _minValue = source._minValue; + _maxValue = source._maxValue; + _offset = source._offset; + _doesCopy = source._doesCopy; + _min = source._min; + _max = source._max; + } } } diff --git a/lib/src/generated/constraints/transform_component_constraint_y_base.dart b/lib/src/generated/constraints/transform_component_constraint_y_base.dart index 2fee3da..6fad9bb 100644 --- a/lib/src/generated/constraints/transform_component_constraint_y_base.dart +++ b/lib/src/generated/constraints/transform_component_constraint_y_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/transform_component_constraint_y_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/generated/constraints/targeted_constraint_base.dart'; @@ -169,13 +170,15 @@ abstract class TransformComponentConstraintYBase void maxYChanged(bool from, bool to); @override - void copy(covariant TransformComponentConstraintYBase source) { + void copy(Core source) { super.copy(source); - _copyFactorY = source._copyFactorY; - _minValueY = source._minValueY; - _maxValueY = source._maxValueY; - _doesCopyY = source._doesCopyY; - _minY = source._minY; - _maxY = source._maxY; + if (source is TransformComponentConstraintYBase) { + _copyFactorY = source._copyFactorY; + _minValueY = source._minValueY; + _maxValueY = source._maxValueY; + _doesCopyY = source._doesCopyY; + _minY = source._minY; + _maxY = source._maxY; + } } } diff --git a/lib/src/generated/constraints/transform_constraint_base.dart b/lib/src/generated/constraints/transform_constraint_base.dart index b278a18..cd9d057 100644 --- a/lib/src/generated/constraints/transform_constraint_base.dart +++ b/lib/src/generated/constraints/transform_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/transform_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/generated/constraints/targeted_constraint_base.dart'; @@ -69,9 +70,11 @@ abstract class TransformConstraintBase extends TransformSpaceConstraint { void originYChanged(double from, double to); @override - void copy(covariant TransformConstraintBase source) { + void copy(Core source) { super.copy(source); - _originX = source._originX; - _originY = source._originY; + if (source is TransformConstraintBase) { + _originX = source._originX; + _originY = source._originY; + } } } diff --git a/lib/src/generated/constraints/transform_space_constraint_base.dart b/lib/src/generated/constraints/transform_space_constraint_base.dart index 377dc94..3b9e6c4 100644 --- a/lib/src/generated/constraints/transform_space_constraint_base.dart +++ b/lib/src/generated/constraints/transform_space_constraint_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/constraints/transform_space_constraint_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/constraints/constraint_base.dart'; import 'package:rive/src/rive_core/constraints/targeted_constraint.dart'; @@ -69,9 +70,11 @@ abstract class TransformSpaceConstraintBase extends TargetedConstraint { void destSpaceValueChanged(int from, int to); @override - void copy(covariant TransformSpaceConstraintBase source) { + void copy(Core source) { super.copy(source); - _sourceSpaceValue = source._sourceSpaceValue; - _destSpaceValue = source._destSpaceValue; + if (source is TransformSpaceConstraintBase) { + _sourceSpaceValue = source._sourceSpaceValue; + _destSpaceValue = source._destSpaceValue; + } } } diff --git a/lib/src/generated/custom_property_base.dart b/lib/src/generated/custom_property_base.dart new file mode 100644 index 0000000..9a404d9 --- /dev/null +++ b/lib/src/generated/custom_property_base.dart @@ -0,0 +1,12 @@ +// Core automatically generated lib/src/generated/custom_property_base.dart. +// Do not modify manually. + +import 'package:rive/src/rive_core/component.dart'; + +abstract class CustomPropertyBase extends Component { + static const int typeKey = 167; + @override + int get coreType => CustomPropertyBase.typeKey; + @override + Set get coreTypes => {CustomPropertyBase.typeKey, ComponentBase.typeKey}; +} diff --git a/lib/src/generated/custom_property_boolean_base.dart b/lib/src/generated/custom_property_boolean_base.dart index ceabbb0..45bc3b1 100644 --- a/lib/src/generated/custom_property_boolean_base.dart +++ b/lib/src/generated/custom_property_boolean_base.dart @@ -2,15 +2,20 @@ // lib/src/generated/custom_property_boolean_base.dart. // Do not modify manually. -import 'package:rive/src/rive_core/component.dart'; +import 'package:rive/src/core/core.dart'; +import 'package:rive/src/generated/component_base.dart'; +import 'package:rive/src/rive_core/custom_property.dart'; -abstract class CustomPropertyBooleanBase extends Component { +abstract class CustomPropertyBooleanBase extends CustomProperty { static const int typeKey = 129; @override int get coreType => CustomPropertyBooleanBase.typeKey; @override - Set get coreTypes => - {CustomPropertyBooleanBase.typeKey, ComponentBase.typeKey}; + Set get coreTypes => { + CustomPropertyBooleanBase.typeKey, + CustomPropertyBase.typeKey, + ComponentBase.typeKey + }; /// -------------------------------------------------------------------------- /// PropertyValue field with key 245. @@ -36,8 +41,10 @@ abstract class CustomPropertyBooleanBase extends Component { void propertyValueChanged(bool from, bool to); @override - void copy(covariant CustomPropertyBooleanBase source) { + void copy(Core source) { super.copy(source); - _propertyValue = source._propertyValue; + if (source is CustomPropertyBooleanBase) { + _propertyValue = source._propertyValue; + } } } diff --git a/lib/src/generated/custom_property_number_base.dart b/lib/src/generated/custom_property_number_base.dart index e41f7dd..7f99eaf 100644 --- a/lib/src/generated/custom_property_number_base.dart +++ b/lib/src/generated/custom_property_number_base.dart @@ -2,15 +2,20 @@ // lib/src/generated/custom_property_number_base.dart. // Do not modify manually. -import 'package:rive/src/rive_core/component.dart'; +import 'package:rive/src/core/core.dart'; +import 'package:rive/src/generated/component_base.dart'; +import 'package:rive/src/rive_core/custom_property.dart'; -abstract class CustomPropertyNumberBase extends Component { +abstract class CustomPropertyNumberBase extends CustomProperty { static const int typeKey = 127; @override int get coreType => CustomPropertyNumberBase.typeKey; @override - Set get coreTypes => - {CustomPropertyNumberBase.typeKey, ComponentBase.typeKey}; + Set get coreTypes => { + CustomPropertyNumberBase.typeKey, + CustomPropertyBase.typeKey, + ComponentBase.typeKey + }; /// -------------------------------------------------------------------------- /// PropertyValue field with key 243. @@ -36,8 +41,10 @@ abstract class CustomPropertyNumberBase extends Component { void propertyValueChanged(double from, double to); @override - void copy(covariant CustomPropertyNumberBase source) { + void copy(Core source) { super.copy(source); - _propertyValue = source._propertyValue; + if (source is CustomPropertyNumberBase) { + _propertyValue = source._propertyValue; + } } } diff --git a/lib/src/generated/custom_property_string_base.dart b/lib/src/generated/custom_property_string_base.dart index 0c0d791..963ffd5 100644 --- a/lib/src/generated/custom_property_string_base.dart +++ b/lib/src/generated/custom_property_string_base.dart @@ -2,15 +2,20 @@ // lib/src/generated/custom_property_string_base.dart. // Do not modify manually. -import 'package:rive/src/rive_core/component.dart'; +import 'package:rive/src/core/core.dart'; +import 'package:rive/src/generated/component_base.dart'; +import 'package:rive/src/rive_core/custom_property.dart'; -abstract class CustomPropertyStringBase extends Component { +abstract class CustomPropertyStringBase extends CustomProperty { static const int typeKey = 130; @override int get coreType => CustomPropertyStringBase.typeKey; @override - Set get coreTypes => - {CustomPropertyStringBase.typeKey, ComponentBase.typeKey}; + Set get coreTypes => { + CustomPropertyStringBase.typeKey, + CustomPropertyBase.typeKey, + ComponentBase.typeKey + }; /// -------------------------------------------------------------------------- /// PropertyValue field with key 246. @@ -36,8 +41,10 @@ abstract class CustomPropertyStringBase extends Component { void propertyValueChanged(String from, String to); @override - void copy(covariant CustomPropertyStringBase source) { + void copy(Core source) { super.copy(source); - _propertyValue = source._propertyValue; + if (source is CustomPropertyStringBase) { + _propertyValue = source._propertyValue; + } } } diff --git a/lib/src/generated/draw_rules_base.dart b/lib/src/generated/draw_rules_base.dart index e96fd5a..c57bc36 100644 --- a/lib/src/generated/draw_rules_base.dart +++ b/lib/src/generated/draw_rules_base.dart @@ -42,8 +42,10 @@ abstract class DrawRulesBase extends ContainerComponent { void drawTargetIdChanged(int from, int to); @override - void copy(covariant DrawRulesBase source) { + void copy(Core source) { super.copy(source); - _drawTargetId = source._drawTargetId; + if (source is DrawRulesBase) { + _drawTargetId = source._drawTargetId; + } } } diff --git a/lib/src/generated/draw_target_base.dart b/lib/src/generated/draw_target_base.dart index 987b22e..b0c2176 100644 --- a/lib/src/generated/draw_target_base.dart +++ b/lib/src/generated/draw_target_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/draw_target_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class DrawTargetBase extends Component { @@ -60,9 +61,11 @@ abstract class DrawTargetBase extends Component { void placementValueChanged(int from, int to); @override - void copy(covariant DrawTargetBase source) { + void copy(Core source) { super.copy(source); - _drawableId = source._drawableId; - _placementValue = source._placementValue; + if (source is DrawTargetBase) { + _drawableId = source._drawableId; + _placementValue = source._placementValue; + } } } diff --git a/lib/src/generated/drawable_base.dart b/lib/src/generated/drawable_base.dart index 3f12e12..8373d28 100644 --- a/lib/src/generated/drawable_base.dart +++ b/lib/src/generated/drawable_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/drawable_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/transform_component_base.dart'; @@ -68,9 +69,11 @@ abstract class DrawableBase extends Node { void drawableFlagsChanged(int from, int to); @override - void copy(covariant DrawableBase source) { + void copy(Core source) { super.copy(source); - _blendModeValue = source._blendModeValue; - _drawableFlags = source._drawableFlags; + if (source is DrawableBase) { + _blendModeValue = source._blendModeValue; + _drawableFlags = source._drawableFlags; + } } } diff --git a/lib/src/generated/joystick_base.dart b/lib/src/generated/joystick_base.dart index 890a11d..52cc01c 100644 --- a/lib/src/generated/joystick_base.dart +++ b/lib/src/generated/joystick_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/joystick_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class JoystickBase extends Component { @@ -289,19 +290,21 @@ abstract class JoystickBase extends Component { void handleSourceIdChanged(int from, int to); @override - void copy(covariant JoystickBase source) { + void copy(Core source) { super.copy(source); - _x = source._x; - _y = source._y; - _posX = source._posX; - _posY = source._posY; - _originX = source._originX; - _originY = source._originY; - _width = source._width; - _height = source._height; - _xId = source._xId; - _yId = source._yId; - _joystickFlags = source._joystickFlags; - _handleSourceId = source._handleSourceId; + if (source is JoystickBase) { + _x = source._x; + _y = source._y; + _posX = source._posX; + _posY = source._posY; + _originX = source._originX; + _originY = source._originY; + _width = source._width; + _height = source._height; + _xId = source._xId; + _yId = source._yId; + _joystickFlags = source._joystickFlags; + _handleSourceId = source._handleSourceId; + } } } diff --git a/lib/src/generated/nested_animation_base.dart b/lib/src/generated/nested_animation_base.dart index d72fc92..a991b8f 100644 --- a/lib/src/generated/nested_animation_base.dart +++ b/lib/src/generated/nested_animation_base.dart @@ -42,8 +42,10 @@ abstract class NestedAnimationBase extends ContainerComponent { void animationIdChanged(int from, int to); @override - void copy(covariant NestedAnimationBase source) { + void copy(Core source) { super.copy(source); - _animationId = source._animationId; + if (source is NestedAnimationBase) { + _animationId = source._animationId; + } } } diff --git a/lib/src/generated/nested_artboard_base.dart b/lib/src/generated/nested_artboard_base.dart index e409b21..9c7e4e3 100644 --- a/lib/src/generated/nested_artboard_base.dart +++ b/lib/src/generated/nested_artboard_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/nested_artboard_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -48,8 +49,10 @@ abstract class NestedArtboardBase extends Drawable { void artboardIdChanged(int from, int to); @override - void copy(covariant NestedArtboardBase source) { + void copy(Core source) { super.copy(source); - _artboardId = source._artboardId; + if (source is NestedArtboardBase) { + _artboardId = source._artboardId; + } } } diff --git a/lib/src/generated/node_base.dart b/lib/src/generated/node_base.dart index d99365c..5d78642 100644 --- a/lib/src/generated/node_base.dart +++ b/lib/src/generated/node_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/node_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/world_transform_component_base.dart'; @@ -68,9 +69,11 @@ abstract class NodeBase extends TransformComponent { void yChanged(double from, double to); @override - void copy(covariant NodeBase source) { + void copy(Core source) { super.copy(source); - _x = source._x; - _y = source._y; + if (source is NodeBase) { + _x = source._x; + _y = source._y; + } } } diff --git a/lib/src/generated/rive_core_context.dart b/lib/src/generated/rive_core_context.dart index 8581443..25bd6d3 100644 --- a/lib/src/generated/rive_core_context.dart +++ b/lib/src/generated/rive_core_context.dart @@ -58,6 +58,7 @@ import 'package:rive/src/rive_core/animation/keyframe_string.dart'; import 'package:rive/src/rive_core/animation/linear_animation.dart'; import 'package:rive/src/rive_core/animation/listener_align_target.dart'; import 'package:rive/src/rive_core/animation/listener_bool_change.dart'; +import 'package:rive/src/rive_core/animation/listener_fire_event.dart'; import 'package:rive/src/rive_core/animation/listener_number_change.dart'; import 'package:rive/src/rive_core/animation/listener_trigger_change.dart'; import 'package:rive/src/rive_core/animation/nested_bool.dart'; @@ -164,6 +165,8 @@ class RiveCoreContext { return NestedArtboard(); case SoloBase.typeKey: return Solo(); + case ListenerFireEventBase.typeKey: + return ListenerFireEvent(); case AnimationBase.typeKey: return Animation(); case LinearAnimationBase.typeKey: @@ -562,6 +565,11 @@ class RiveCoreContext { object.activeComponentId = value; } break; + case ListenerFireEventBase.eventIdPropertyKey: + if (object is ListenerFireEventBase && value is int) { + object.eventId = value; + } + break; case AnimationBase.namePropertyKey: if (object is AnimationBase && value is String) { object.name = value; @@ -1482,6 +1490,11 @@ class RiveCoreContext { object.lineHeight = value; } break; + case TextStyleBase.letterSpacingPropertyKey: + if (object is TextStyleBase && value is double) { + object.letterSpacing = value; + } + break; case TextStyleBase.fontAssetIdPropertyKey: if (object is TextStyleBase && value is int) { object.fontAssetId = value; @@ -1626,6 +1639,7 @@ class RiveCoreContext { case NestedArtboardBase.artboardIdPropertyKey: case NestedAnimationBase.animationIdPropertyKey: case SoloBase.activeComponentIdPropertyKey: + case ListenerFireEventBase.eventIdPropertyKey: case LinearAnimationBase.fpsPropertyKey: case LinearAnimationBase.durationPropertyKey: case LinearAnimationBase.loopValuePropertyKey: @@ -1816,6 +1830,7 @@ class RiveCoreContext { case TextModifierGroupBase.scaleYPropertyKey: case TextStyleBase.fontSizePropertyKey: case TextStyleBase.lineHeightPropertyKey: + case TextStyleBase.letterSpacingPropertyKey: case TextStyleAxisBase.axisValuePropertyKey: case TextBase.widthPropertyKey: case TextBase.heightPropertyKey: @@ -1915,6 +1930,8 @@ class RiveCoreContext { return (object as NestedAnimationBase).animationId; case SoloBase.activeComponentIdPropertyKey: return (object as SoloBase).activeComponentId; + case ListenerFireEventBase.eventIdPropertyKey: + return (object as ListenerFireEventBase).eventId; case LinearAnimationBase.fpsPropertyKey: return (object as LinearAnimationBase).fps; case LinearAnimationBase.durationPropertyKey: @@ -2299,6 +2316,8 @@ class RiveCoreContext { return (object as TextStyleBase).fontSize; case TextStyleBase.lineHeightPropertyKey: return (object as TextStyleBase).lineHeight; + case TextStyleBase.letterSpacingPropertyKey: + return (object as TextStyleBase).letterSpacing; case TextStyleAxisBase.axisValuePropertyKey: return (object as TextStyleAxisBase).axisValue; case TextBase.widthPropertyKey: @@ -2514,6 +2533,11 @@ class RiveCoreContext { object.activeComponentId = value; } break; + case ListenerFireEventBase.eventIdPropertyKey: + if (object is ListenerFireEventBase) { + object.eventId = value; + } + break; case LinearAnimationBase.fpsPropertyKey: if (object is LinearAnimationBase) { object.fps = value; @@ -3464,6 +3488,11 @@ class RiveCoreContext { object.lineHeight = value; } break; + case TextStyleBase.letterSpacingPropertyKey: + if (object is TextStyleBase) { + object.letterSpacing = value; + } + break; case TextStyleAxisBase.axisValuePropertyKey: if (object is TextStyleAxisBase) { object.axisValue = value; diff --git a/lib/src/generated/shapes/clipping_shape_base.dart b/lib/src/generated/shapes/clipping_shape_base.dart index bb748c8..a71f377 100644 --- a/lib/src/generated/shapes/clipping_shape_base.dart +++ b/lib/src/generated/shapes/clipping_shape_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/clipping_shape_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class ClippingShapeBase extends Component { @@ -82,10 +83,12 @@ abstract class ClippingShapeBase extends Component { void isVisibleChanged(bool from, bool to); @override - void copy(covariant ClippingShapeBase source) { + void copy(Core source) { super.copy(source); - _sourceId = source._sourceId; - _fillRule = source._fillRule; - _isVisible = source._isVisible; + if (source is ClippingShapeBase) { + _sourceId = source._sourceId; + _fillRule = source._fillRule; + _isVisible = source._isVisible; + } } } diff --git a/lib/src/generated/shapes/cubic_asymmetric_vertex_base.dart b/lib/src/generated/shapes/cubic_asymmetric_vertex_base.dart index dd8420f..550636d 100644 --- a/lib/src/generated/shapes/cubic_asymmetric_vertex_base.dart +++ b/lib/src/generated/shapes/cubic_asymmetric_vertex_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/cubic_asymmetric_vertex_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/shapes/path_vertex_base.dart'; @@ -96,10 +97,12 @@ abstract class CubicAsymmetricVertexBase extends CubicVertex { void outDistanceChanged(double from, double to); @override - void copy(covariant CubicAsymmetricVertexBase source) { + void copy(Core source) { super.copy(source); - _rotation = source._rotation; - _inDistance = source._inDistance; - _outDistance = source._outDistance; + if (source is CubicAsymmetricVertexBase) { + _rotation = source._rotation; + _inDistance = source._inDistance; + _outDistance = source._outDistance; + } } } diff --git a/lib/src/generated/shapes/cubic_detached_vertex_base.dart b/lib/src/generated/shapes/cubic_detached_vertex_base.dart index 124b367..c3473b9 100644 --- a/lib/src/generated/shapes/cubic_detached_vertex_base.dart +++ b/lib/src/generated/shapes/cubic_detached_vertex_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/cubic_detached_vertex_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/shapes/path_vertex_base.dart'; @@ -121,11 +122,13 @@ abstract class CubicDetachedVertexBase extends CubicVertex { void outDistanceChanged(double from, double to); @override - void copy(covariant CubicDetachedVertexBase source) { + void copy(Core source) { super.copy(source); - _inRotation = source._inRotation; - _inDistance = source._inDistance; - _outRotation = source._outRotation; - _outDistance = source._outDistance; + if (source is CubicDetachedVertexBase) { + _inRotation = source._inRotation; + _inDistance = source._inDistance; + _outRotation = source._outRotation; + _outDistance = source._outDistance; + } } } diff --git a/lib/src/generated/shapes/cubic_mirrored_vertex_base.dart b/lib/src/generated/shapes/cubic_mirrored_vertex_base.dart index 1d0b937..a63c534 100644 --- a/lib/src/generated/shapes/cubic_mirrored_vertex_base.dart +++ b/lib/src/generated/shapes/cubic_mirrored_vertex_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/cubic_mirrored_vertex_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/shapes/path_vertex_base.dart'; @@ -71,9 +72,11 @@ abstract class CubicMirroredVertexBase extends CubicVertex { void distanceChanged(double from, double to); @override - void copy(covariant CubicMirroredVertexBase source) { + void copy(Core source) { super.copy(source); - _rotation = source._rotation; - _distance = source._distance; + if (source is CubicMirroredVertexBase) { + _rotation = source._rotation; + _distance = source._distance; + } } } diff --git a/lib/src/generated/shapes/image_base.dart b/lib/src/generated/shapes/image_base.dart index 682e00b..f5a7438 100644 --- a/lib/src/generated/shapes/image_base.dart +++ b/lib/src/generated/shapes/image_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/image_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -96,10 +97,12 @@ abstract class ImageBase extends Drawable { void originYChanged(double from, double to); @override - void copy(covariant ImageBase source) { + void copy(Core source) { super.copy(source); - _assetId = source._assetId; - _originX = source._originX; - _originY = source._originY; + if (source is ImageBase) { + _assetId = source._assetId; + _originX = source._originX; + _originY = source._originY; + } } } diff --git a/lib/src/generated/shapes/mesh_base.dart b/lib/src/generated/shapes/mesh_base.dart index 1290ffb..098a376 100644 --- a/lib/src/generated/shapes/mesh_base.dart +++ b/lib/src/generated/shapes/mesh_base.dart @@ -39,8 +39,10 @@ abstract class MeshBase extends ContainerComponent { void triangleIndexBytesChanged(Uint8List from, Uint8List to); @override - void copy(covariant MeshBase source) { + void copy(Core source) { super.copy(source); - _triangleIndexBytes = source._triangleIndexBytes; + if (source is MeshBase) { + _triangleIndexBytes = source._triangleIndexBytes; + } } } diff --git a/lib/src/generated/shapes/mesh_vertex_base.dart b/lib/src/generated/shapes/mesh_vertex_base.dart index 1ce37fc..4fef8d4 100644 --- a/lib/src/generated/shapes/mesh_vertex_base.dart +++ b/lib/src/generated/shapes/mesh_vertex_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/mesh_vertex_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/rive_core/shapes/vertex.dart'; @@ -66,9 +67,11 @@ abstract class MeshVertexBase extends Vertex { void vChanged(double from, double to); @override - void copy(covariant MeshVertexBase source) { + void copy(Core source) { super.copy(source); - _u = source._u; - _v = source._v; + if (source is MeshVertexBase) { + _u = source._u; + _v = source._v; + } } } diff --git a/lib/src/generated/shapes/paint/fill_base.dart b/lib/src/generated/shapes/paint/fill_base.dart index 7b0f1ed..610644e 100644 --- a/lib/src/generated/shapes/paint/fill_base.dart +++ b/lib/src/generated/shapes/paint/fill_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/paint/fill_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/rive_core/shapes/paint/shape_paint.dart'; @@ -40,8 +41,10 @@ abstract class FillBase extends ShapePaint { void fillRuleChanged(int from, int to); @override - void copy(covariant FillBase source) { + void copy(Core source) { super.copy(source); - _fillRule = source._fillRule; + if (source is FillBase) { + _fillRule = source._fillRule; + } } } diff --git a/lib/src/generated/shapes/paint/gradient_stop_base.dart b/lib/src/generated/shapes/paint/gradient_stop_base.dart index 0897349..b64aba7 100644 --- a/lib/src/generated/shapes/paint/gradient_stop_base.dart +++ b/lib/src/generated/shapes/paint/gradient_stop_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/paint/gradient_stop_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class GradientStopBase extends Component { @@ -56,9 +57,11 @@ abstract class GradientStopBase extends Component { void positionChanged(double from, double to); @override - void copy(covariant GradientStopBase source) { + void copy(Core source) { super.copy(source); - _colorValue = source._colorValue; - _position = source._position; + if (source is GradientStopBase) { + _colorValue = source._colorValue; + _position = source._position; + } } } diff --git a/lib/src/generated/shapes/paint/linear_gradient_base.dart b/lib/src/generated/shapes/paint/linear_gradient_base.dart index 949ea80..31dee87 100644 --- a/lib/src/generated/shapes/paint/linear_gradient_base.dart +++ b/lib/src/generated/shapes/paint/linear_gradient_base.dart @@ -128,12 +128,14 @@ abstract class LinearGradientBase extends ContainerComponent { void opacityChanged(double from, double to); @override - void copy(covariant LinearGradientBase source) { + void copy(Core source) { super.copy(source); - _startX = source._startX; - _startY = source._startY; - _endX = source._endX; - _endY = source._endY; - _opacity = source._opacity; + if (source is LinearGradientBase) { + _startX = source._startX; + _startY = source._startY; + _endX = source._endX; + _endY = source._endY; + _opacity = source._opacity; + } } } diff --git a/lib/src/generated/shapes/paint/shape_paint_base.dart b/lib/src/generated/shapes/paint/shape_paint_base.dart index 011cf8b..5f41b27 100644 --- a/lib/src/generated/shapes/paint/shape_paint_base.dart +++ b/lib/src/generated/shapes/paint/shape_paint_base.dart @@ -40,8 +40,10 @@ abstract class ShapePaintBase extends ContainerComponent { void isVisibleChanged(bool from, bool to); @override - void copy(covariant ShapePaintBase source) { + void copy(Core source) { super.copy(source); - _isVisible = source._isVisible; + if (source is ShapePaintBase) { + _isVisible = source._isVisible; + } } } diff --git a/lib/src/generated/shapes/paint/solid_color_base.dart b/lib/src/generated/shapes/paint/solid_color_base.dart index 7c83782..9e5cf45 100644 --- a/lib/src/generated/shapes/paint/solid_color_base.dart +++ b/lib/src/generated/shapes/paint/solid_color_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/paint/solid_color_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class SolidColorBase extends Component { @@ -34,8 +35,10 @@ abstract class SolidColorBase extends Component { void colorValueChanged(int from, int to); @override - void copy(covariant SolidColorBase source) { + void copy(Core source) { super.copy(source); - _colorValue = source._colorValue; + if (source is SolidColorBase) { + _colorValue = source._colorValue; + } } } diff --git a/lib/src/generated/shapes/paint/stroke_base.dart b/lib/src/generated/shapes/paint/stroke_base.dart index 0d72d7a..8fbdf02 100644 --- a/lib/src/generated/shapes/paint/stroke_base.dart +++ b/lib/src/generated/shapes/paint/stroke_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/paint/stroke_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/rive_core/shapes/paint/shape_paint.dart'; @@ -108,11 +109,13 @@ abstract class StrokeBase extends ShapePaint { void transformAffectsStrokeChanged(bool from, bool to); @override - void copy(covariant StrokeBase source) { + void copy(Core source) { super.copy(source); - _thickness = source._thickness; - _cap = source._cap; - _join = source._join; - _transformAffectsStroke = source._transformAffectsStroke; + if (source is StrokeBase) { + _thickness = source._thickness; + _cap = source._cap; + _join = source._join; + _transformAffectsStroke = source._transformAffectsStroke; + } } } diff --git a/lib/src/generated/shapes/paint/trim_path_base.dart b/lib/src/generated/shapes/paint/trim_path_base.dart index 2538f68..b706011 100644 --- a/lib/src/generated/shapes/paint/trim_path_base.dart +++ b/lib/src/generated/shapes/paint/trim_path_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/paint/trim_path_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class TrimPathBase extends Component { @@ -100,11 +101,13 @@ abstract class TrimPathBase extends Component { void modeValueChanged(int from, int to); @override - void copy(covariant TrimPathBase source) { + void copy(Core source) { super.copy(source); - _start = source._start; - _end = source._end; - _offset = source._offset; - _modeValue = source._modeValue; + if (source is TrimPathBase) { + _start = source._start; + _end = source._end; + _offset = source._offset; + _modeValue = source._modeValue; + } } } diff --git a/lib/src/generated/shapes/parametric_path_base.dart b/lib/src/generated/shapes/parametric_path_base.dart index 120c674..50b2123 100644 --- a/lib/src/generated/shapes/parametric_path_base.dart +++ b/lib/src/generated/shapes/parametric_path_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/parametric_path_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -121,11 +122,13 @@ abstract class ParametricPathBase extends Path { void originYChanged(double from, double to); @override - void copy(covariant ParametricPathBase source) { + void copy(Core source) { super.copy(source); - _width = source._width; - _height = source._height; - _originX = source._originX; - _originY = source._originY; + if (source is ParametricPathBase) { + _width = source._width; + _height = source._height; + _originX = source._originX; + _originY = source._originY; + } } } diff --git a/lib/src/generated/shapes/path_base.dart b/lib/src/generated/shapes/path_base.dart index 751bd4b..4edd569 100644 --- a/lib/src/generated/shapes/path_base.dart +++ b/lib/src/generated/shapes/path_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/path_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/transform_component_base.dart'; @@ -44,8 +45,10 @@ abstract class PathBase extends Node { void pathFlagsChanged(int from, int to); @override - void copy(covariant PathBase source) { + void copy(Core source) { super.copy(source); - _pathFlags = source._pathFlags; + if (source is PathBase) { + _pathFlags = source._pathFlags; + } } } diff --git a/lib/src/generated/shapes/points_path_base.dart b/lib/src/generated/shapes/points_path_base.dart index 1866cb7..a34334e 100644 --- a/lib/src/generated/shapes/points_path_base.dart +++ b/lib/src/generated/shapes/points_path_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/points_path_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -49,8 +50,10 @@ abstract class PointsPathBase extends Path { void isClosedChanged(bool from, bool to); @override - void copy(covariant PointsPathBase source) { + void copy(Core source) { super.copy(source); - _isClosed = source._isClosed; + if (source is PointsPathBase) { + _isClosed = source._isClosed; + } } } diff --git a/lib/src/generated/shapes/polygon_base.dart b/lib/src/generated/shapes/polygon_base.dart index 750dcf0..0ebd013 100644 --- a/lib/src/generated/shapes/polygon_base.dart +++ b/lib/src/generated/shapes/polygon_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/polygon_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -75,9 +76,11 @@ abstract class PolygonBase extends ParametricPath { void cornerRadiusChanged(double from, double to); @override - void copy(covariant PolygonBase source) { + void copy(Core source) { super.copy(source); - _points = source._points; - _cornerRadius = source._cornerRadius; + if (source is PolygonBase) { + _points = source._points; + _cornerRadius = source._cornerRadius; + } } } diff --git a/lib/src/generated/shapes/rectangle_base.dart b/lib/src/generated/shapes/rectangle_base.dart index 071ea2a..911f2f2 100644 --- a/lib/src/generated/shapes/rectangle_base.dart +++ b/lib/src/generated/shapes/rectangle_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/rectangle_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -151,12 +152,14 @@ abstract class RectangleBase extends ParametricPath { void cornerRadiusBRChanged(double from, double to); @override - void copy(covariant RectangleBase source) { + void copy(Core source) { super.copy(source); - _linkCornerRadius = source._linkCornerRadius; - _cornerRadiusTL = source._cornerRadiusTL; - _cornerRadiusTR = source._cornerRadiusTR; - _cornerRadiusBL = source._cornerRadiusBL; - _cornerRadiusBR = source._cornerRadiusBR; + if (source is RectangleBase) { + _linkCornerRadius = source._linkCornerRadius; + _cornerRadiusTL = source._cornerRadiusTL; + _cornerRadiusTR = source._cornerRadiusTR; + _cornerRadiusBL = source._cornerRadiusBL; + _cornerRadiusBR = source._cornerRadiusBR; + } } } diff --git a/lib/src/generated/shapes/star_base.dart b/lib/src/generated/shapes/star_base.dart index d0e7158..82ddf3c 100644 --- a/lib/src/generated/shapes/star_base.dart +++ b/lib/src/generated/shapes/star_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/shapes/star_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -53,8 +54,10 @@ abstract class StarBase extends Polygon { void innerRadiusChanged(double from, double to); @override - void copy(covariant StarBase source) { + void copy(Core source) { super.copy(source); - _innerRadius = source._innerRadius; + if (source is StarBase) { + _innerRadius = source._innerRadius; + } } } diff --git a/lib/src/generated/shapes/straight_vertex_base.dart b/lib/src/generated/shapes/straight_vertex_base.dart index b72771f..0f41813 100644 --- a/lib/src/generated/shapes/straight_vertex_base.dart +++ b/lib/src/generated/shapes/straight_vertex_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/shapes/straight_vertex_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/shapes/vertex_base.dart'; @@ -46,8 +47,10 @@ abstract class StraightVertexBase extends PathVertex { void radiusChanged(double from, double to); @override - void copy(covariant StraightVertexBase source) { + void copy(Core source) { super.copy(source); - _radius = source._radius; + if (source is StraightVertexBase) { + _radius = source._radius; + } } } diff --git a/lib/src/generated/shapes/vertex_base.dart b/lib/src/generated/shapes/vertex_base.dart index e761f29..c67526c 100644 --- a/lib/src/generated/shapes/vertex_base.dart +++ b/lib/src/generated/shapes/vertex_base.dart @@ -65,9 +65,11 @@ abstract class VertexBase extends ContainerComponent { void yChanged(double from, double to); @override - void copy(covariant VertexBase source) { + void copy(Core source) { super.copy(source); - _x = source._x; - _y = source._y; + if (source is VertexBase) { + _x = source._x; + _y = source._y; + } } } diff --git a/lib/src/generated/solo_base.dart b/lib/src/generated/solo_base.dart index 6e060de..951a696 100644 --- a/lib/src/generated/solo_base.dart +++ b/lib/src/generated/solo_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/solo_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/transform_component_base.dart'; @@ -47,8 +48,10 @@ abstract class SoloBase extends Node { void activeComponentIdChanged(int from, int to); @override - void copy(covariant SoloBase source) { + void copy(Core source) { super.copy(source); - _activeComponentId = source._activeComponentId; + if (source is SoloBase) { + _activeComponentId = source._activeComponentId; + } } } diff --git a/lib/src/generated/text/text_base.dart b/lib/src/generated/text/text_base.dart index 12bb407..ad4b6fa 100644 --- a/lib/src/generated/text/text_base.dart +++ b/lib/src/generated/text/text_base.dart @@ -1,6 +1,7 @@ // Core automatically generated lib/src/generated/text/text_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/generated/node_base.dart'; @@ -238,16 +239,18 @@ abstract class TextBase extends Drawable { void originValueChanged(int from, int to); @override - void copy(covariant TextBase source) { + void copy(Core source) { super.copy(source); - _alignValue = source._alignValue; - _sizingValue = source._sizingValue; - _overflowValue = source._overflowValue; - _width = source._width; - _height = source._height; - _originX = source._originX; - _originY = source._originY; - _paragraphSpacing = source._paragraphSpacing; - _originValue = source._originValue; + if (source is TextBase) { + _alignValue = source._alignValue; + _sizingValue = source._sizingValue; + _overflowValue = source._overflowValue; + _width = source._width; + _height = source._height; + _originX = source._originX; + _originY = source._originY; + _paragraphSpacing = source._paragraphSpacing; + _originValue = source._originValue; + } } } diff --git a/lib/src/generated/text/text_modifier_group_base.dart b/lib/src/generated/text/text_modifier_group_base.dart index 610cd12..0314161 100644 --- a/lib/src/generated/text/text_modifier_group_base.dart +++ b/lib/src/generated/text/text_modifier_group_base.dart @@ -217,16 +217,18 @@ abstract class TextModifierGroupBase extends ContainerComponent { void scaleYChanged(double from, double to); @override - void copy(covariant TextModifierGroupBase source) { + void copy(Core source) { super.copy(source); - _modifierFlags = source._modifierFlags; - _originX = source._originX; - _originY = source._originY; - _opacity = source._opacity; - _x = source._x; - _y = source._y; - _rotation = source._rotation; - _scaleX = source._scaleX; - _scaleY = source._scaleY; + if (source is TextModifierGroupBase) { + _modifierFlags = source._modifierFlags; + _originX = source._originX; + _originY = source._originY; + _opacity = source._opacity; + _x = source._x; + _y = source._y; + _rotation = source._rotation; + _scaleX = source._scaleX; + _scaleY = source._scaleY; + } } } diff --git a/lib/src/generated/text/text_modifier_range_base.dart b/lib/src/generated/text/text_modifier_range_base.dart index a589bb0..cf95943 100644 --- a/lib/src/generated/text/text_modifier_range_base.dart +++ b/lib/src/generated/text/text_modifier_range_base.dart @@ -263,18 +263,20 @@ abstract class TextModifierRangeBase extends ContainerComponent { void runIdChanged(int from, int to); @override - void copy(covariant TextModifierRangeBase source) { + void copy(Core source) { super.copy(source); - _modifyFrom = source._modifyFrom; - _modifyTo = source._modifyTo; - _strength = source._strength; - _unitsValue = source._unitsValue; - _typeValue = source._typeValue; - _modeValue = source._modeValue; - _clamp = source._clamp; - _falloffFrom = source._falloffFrom; - _falloffTo = source._falloffTo; - _offset = source._offset; - _runId = source._runId; + if (source is TextModifierRangeBase) { + _modifyFrom = source._modifyFrom; + _modifyTo = source._modifyTo; + _strength = source._strength; + _unitsValue = source._unitsValue; + _typeValue = source._typeValue; + _modeValue = source._modeValue; + _clamp = source._clamp; + _falloffFrom = source._falloffFrom; + _falloffTo = source._falloffTo; + _offset = source._offset; + _runId = source._runId; + } } } diff --git a/lib/src/generated/text/text_style_axis_base.dart b/lib/src/generated/text/text_style_axis_base.dart index 79649e1..ae83caf 100644 --- a/lib/src/generated/text/text_style_axis_base.dart +++ b/lib/src/generated/text/text_style_axis_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/text/text_style_axis_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class TextStyleAxisBase extends Component { @@ -56,9 +57,11 @@ abstract class TextStyleAxisBase extends Component { void axisValueChanged(double from, double to); @override - void copy(covariant TextStyleAxisBase source) { + void copy(Core source) { super.copy(source); - _tag = source._tag; - _axisValue = source._axisValue; + if (source is TextStyleAxisBase) { + _tag = source._tag; + _axisValue = source._axisValue; + } } } diff --git a/lib/src/generated/text/text_style_base.dart b/lib/src/generated/text/text_style_base.dart index d589257..144424c 100644 --- a/lib/src/generated/text/text_style_base.dart +++ b/lib/src/generated/text/text_style_base.dart @@ -60,6 +60,29 @@ abstract class TextStyleBase extends ContainerComponent { void lineHeightChanged(double from, double to); + /// -------------------------------------------------------------------------- + /// LetterSpacing field with key 390. + static const double letterSpacingInitialValue = 0.0; + double _letterSpacing = letterSpacingInitialValue; + static const int letterSpacingPropertyKey = 390; + double get letterSpacing => _letterSpacing; + + /// Change the [_letterSpacing] field value. + /// [letterSpacingChanged] will be invoked only if the field's value has + /// changed. + set letterSpacing(double value) { + if (_letterSpacing == value) { + return; + } + double from = _letterSpacing; + _letterSpacing = value; + if (hasValidated) { + letterSpacingChanged(from, value); + } + } + + void letterSpacingChanged(double from, double to); + /// -------------------------------------------------------------------------- /// FontAssetId field with key 279. static const int fontAssetIdInitialValue = -1; @@ -84,10 +107,13 @@ abstract class TextStyleBase extends ContainerComponent { void fontAssetIdChanged(int from, int to); @override - void copy(covariant TextStyleBase source) { + void copy(Core source) { super.copy(source); - _fontSize = source._fontSize; - _lineHeight = source._lineHeight; - _fontAssetId = source._fontAssetId; + if (source is TextStyleBase) { + _fontSize = source._fontSize; + _lineHeight = source._lineHeight; + _letterSpacing = source._letterSpacing; + _fontAssetId = source._fontAssetId; + } } } diff --git a/lib/src/generated/text/text_style_feature_base.dart b/lib/src/generated/text/text_style_feature_base.dart index 878394d..c4f025c 100644 --- a/lib/src/generated/text/text_style_feature_base.dart +++ b/lib/src/generated/text/text_style_feature_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/text/text_style_feature_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class TextStyleFeatureBase extends Component { @@ -58,9 +59,11 @@ abstract class TextStyleFeatureBase extends Component { void featureValueChanged(int from, int to); @override - void copy(covariant TextStyleFeatureBase source) { + void copy(Core source) { super.copy(source); - _tag = source._tag; - _featureValue = source._featureValue; + if (source is TextStyleFeatureBase) { + _tag = source._tag; + _featureValue = source._featureValue; + } } } diff --git a/lib/src/generated/text/text_value_run_base.dart b/lib/src/generated/text/text_value_run_base.dart index 783dbbf..a0efdfd 100644 --- a/lib/src/generated/text/text_value_run_base.dart +++ b/lib/src/generated/text/text_value_run_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/text/text_value_run_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/rive_core/component.dart'; abstract class TextValueRunBase extends Component { @@ -60,9 +61,11 @@ abstract class TextValueRunBase extends Component { void textChanged(String from, String to); @override - void copy(covariant TextValueRunBase source) { + void copy(Core source) { super.copy(source); - _styleId = source._styleId; - _text = source._text; + if (source is TextValueRunBase) { + _styleId = source._styleId; + _text = source._text; + } } } diff --git a/lib/src/generated/text/text_variation_modifier_base.dart b/lib/src/generated/text/text_variation_modifier_base.dart index dec3c7c..5c00049 100644 --- a/lib/src/generated/text/text_variation_modifier_base.dart +++ b/lib/src/generated/text/text_variation_modifier_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/text/text_variation_modifier_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/text/text_modifier_base.dart'; import 'package:rive/src/rive_core/text/text_shape_modifier.dart'; @@ -63,9 +64,11 @@ abstract class TextVariationModifierBase extends TextShapeModifier { void axisValueChanged(double from, double to); @override - void copy(covariant TextVariationModifierBase source) { + void copy(Core source) { super.copy(source); - _axisTag = source._axisTag; - _axisValue = source._axisValue; + if (source is TextVariationModifierBase) { + _axisTag = source._axisTag; + _axisValue = source._axisValue; + } } } diff --git a/lib/src/generated/transform_component_base.dart b/lib/src/generated/transform_component_base.dart index 68d4d84..41041fe 100644 --- a/lib/src/generated/transform_component_base.dart +++ b/lib/src/generated/transform_component_base.dart @@ -2,6 +2,7 @@ // lib/src/generated/transform_component_base.dart. // Do not modify manually. +import 'package:rive/src/core/core.dart'; import 'package:rive/src/generated/component_base.dart'; import 'package:rive/src/generated/container_component_base.dart'; import 'package:rive/src/rive_core/world_transform_component.dart'; @@ -85,10 +86,12 @@ abstract class TransformComponentBase extends WorldTransformComponent { void scaleYChanged(double from, double to); @override - void copy(covariant TransformComponentBase source) { + void copy(Core source) { super.copy(source); - _rotation = source._rotation; - _scaleX = source._scaleX; - _scaleY = source._scaleY; + if (source is TransformComponentBase) { + _rotation = source._rotation; + _scaleX = source._scaleX; + _scaleY = source._scaleY; + } } } diff --git a/lib/src/generated/world_transform_component_base.dart b/lib/src/generated/world_transform_component_base.dart index e6a3ce0..490056b 100644 --- a/lib/src/generated/world_transform_component_base.dart +++ b/lib/src/generated/world_transform_component_base.dart @@ -40,8 +40,10 @@ abstract class WorldTransformComponentBase extends ContainerComponent { void opacityChanged(double from, double to); @override - void copy(covariant WorldTransformComponentBase source) { + void copy(Core source) { super.copy(source); - _opacity = source._opacity; + if (source is WorldTransformComponentBase) { + _opacity = source._opacity; + } } } diff --git a/lib/src/rive.dart b/lib/src/rive.dart index 948112f..eb5b5ea 100644 --- a/lib/src/rive.dart +++ b/lib/src/rive.dart @@ -50,9 +50,9 @@ class Rive extends LeafRenderObjectWidget { /// The mouse cursor for mouse pointers that are hovering over the region. /// - /// When a mouse enters the region, its cursor will be changed to the [cursor]. - /// When the mouse leaves the region, the cursor will be decided by the region - /// found at the new location. + /// When a mouse enters the region, its cursor will be changed to the + /// [cursor]. When the mouse leaves the region, the cursor will be decided by + /// the region found at the new location. /// /// The [cursor] defaults to [MouseCursor.defer], deferring the choice of /// cursor to the next region behind it in hit-test order. @@ -83,12 +83,14 @@ class Rive extends LeafRenderObjectWidget { RenderObject createRenderObject(BuildContext context) { // Doing this here and not in constructor so it can remain const artboard.antialiasing = antialiasing; + final tickerModeValue = TickerMode.of(context); return RiveRenderObject(artboard as RuntimeArtboard) ..fit = fit ..alignment = alignment ..artboardSize = Size(artboard.width, artboard.height) ..useArtboardSize = useArtboardSize ..clipRect = clipRect + ..tickerModeEnabled = tickerModeValue ..enableHitTests = enablePointerEvents ..cursor = cursor; } @@ -96,6 +98,7 @@ class Rive extends LeafRenderObjectWidget { @override void updateRenderObject( BuildContext context, covariant RiveRenderObject renderObject) { + final tickerModeValue = TickerMode.of(context); artboard.antialiasing = antialiasing; renderObject ..artboard = artboard @@ -104,6 +107,7 @@ class Rive extends LeafRenderObjectWidget { ..artboardSize = Size(artboard.width, artboard.height) ..useArtboardSize = useArtboardSize ..clipRect = clipRect + ..tickerModeEnabled = tickerModeValue ..enableHitTests = enablePointerEvents ..cursor = cursor; } @@ -230,8 +234,8 @@ class RiveRenderObject extends RiveRenderBox implements MouseTrackerAnnotation { @override void detach() { // It's possible that the renderObject be detached during mouse events - // dispatching, set the [MouseTrackerAnnotation.validForMouseTracker] false to prevent - // the callbacks from being called. + // dispatching, set the [MouseTrackerAnnotation.validForMouseTracker] false + // to prevent the callbacks from being called. _validForMouseTracker = false; super.detach(); } diff --git a/lib/src/rive_core/animation/listener_fire_event.dart b/lib/src/rive_core/animation/listener_fire_event.dart new file mode 100644 index 0000000..a76be82 --- /dev/null +++ b/lib/src/rive_core/animation/listener_fire_event.dart @@ -0,0 +1,37 @@ +import 'package:rive/src/core/core.dart'; +import 'package:rive/src/generated/animation/listener_fire_event_base.dart'; +import 'package:rive/src/rive_core/event.dart'; +import 'package:rive/src/rive_core/state_machine_controller.dart'; +import 'package:rive_common/math.dart'; + +export 'package:rive/src/generated/animation/listener_fire_event_base.dart'; + +class ListenerFireEvent extends ListenerFireEventBase { + Event? _event; + Event? get event => _event; + set event(Event? value) { + if (_event == value) { + return; + } + + _event = value; + + eventId = _event?.id ?? Core.missingId; + } + + @override + void eventIdChanged(int from, int to) { + event = context.resolveWithDefault(to, Event.unknown); + } + + @override + void onAddedDirty() { + super.onAddedDirty(); + event = context.resolveWithDefault(eventId, Event.unknown); + } + + @override + void perform(StateMachineController controller, Vec2D position) { + // TODO: listener.stateMachine.fireEvent() + } +} diff --git a/lib/src/rive_core/custom_property.dart b/lib/src/rive_core/custom_property.dart new file mode 100644 index 0000000..f0e742e --- /dev/null +++ b/lib/src/rive_core/custom_property.dart @@ -0,0 +1,8 @@ +import 'package:rive/src/generated/custom_property_base.dart'; +export 'package:rive/src/generated/custom_property_base.dart'; + +/// A custom property value stored in the hierarchy with a boolean value. +class CustomProperty extends CustomPropertyBase { + @override + void update(int dirt) {} +} diff --git a/lib/src/rive_core/custom_property_boolean.dart b/lib/src/rive_core/custom_property_boolean.dart index 9eb90b3..a7f0686 100644 --- a/lib/src/rive_core/custom_property_boolean.dart +++ b/lib/src/rive_core/custom_property_boolean.dart @@ -3,9 +3,6 @@ export 'package:rive/src/generated/custom_property_boolean_base.dart'; /// A custom property value stored in the hierarchy with a boolean value. class CustomPropertyBoolean extends CustomPropertyBooleanBase { - @override - void update(int dirt) {} - @override void propertyValueChanged(bool from, bool to) {} } diff --git a/lib/src/rive_core/custom_property_number.dart b/lib/src/rive_core/custom_property_number.dart index 023cb0b..d522ae4 100644 --- a/lib/src/rive_core/custom_property_number.dart +++ b/lib/src/rive_core/custom_property_number.dart @@ -3,9 +3,6 @@ export 'package:rive/src/generated/custom_property_number_base.dart'; /// A custom property value stored in the hierarchy with a numeric value. class CustomPropertyNumber extends CustomPropertyNumberBase { - @override - void update(int dirt) {} - @override void propertyValueChanged(double from, double to) {} } diff --git a/lib/src/rive_core/custom_property_string.dart b/lib/src/rive_core/custom_property_string.dart index 024da89..69b94ff 100644 --- a/lib/src/rive_core/custom_property_string.dart +++ b/lib/src/rive_core/custom_property_string.dart @@ -3,9 +3,6 @@ export 'package:rive/src/generated/custom_property_string_base.dart'; /// A custom property value stored in the hierarchy with a string value. class CustomPropertyString extends CustomPropertyStringBase { - @override - void update(int dirt) {} - @override void propertyValueChanged(String from, String to) {} } diff --git a/lib/src/rive_core/event.dart b/lib/src/rive_core/event.dart index a4db721..376b242 100644 --- a/lib/src/rive_core/event.dart +++ b/lib/src/rive_core/event.dart @@ -1,15 +1,13 @@ import 'package:rive/src/generated/event_base.dart'; import 'package:rive/src/rive_core/artboard.dart'; import 'package:rive/src/rive_core/component.dart'; -import 'package:rive/src/rive_core/custom_property_boolean.dart'; -import 'package:rive/src/rive_core/custom_property_number.dart'; -import 'package:rive/src/rive_core/custom_property_string.dart'; +import 'package:rive/src/rive_core/custom_property.dart'; import 'package:rive_common/utilities.dart'; export 'package:rive/src/generated/event_base.dart'; class Event extends EventBase { - final Set customProperties = {}; + final List customProperties = []; @override void typeChanged(String from, String to) {} @@ -25,18 +23,7 @@ class Event extends EventBase { } void _syncCustomProperties() { - var nextCustomProperties = children.where( - (child) { - switch (child.coreType) { - case CustomPropertyBooleanBase.typeKey: - case CustomPropertyStringBase.typeKey: - case CustomPropertyNumberBase.typeKey: - return true; - default: - return false; - } - }, - ).toSet(); + var nextCustomProperties = children.whereType().toSet(); if (!iterableEquals(customProperties, nextCustomProperties)) { customProperties.clear(); customProperties.addAll(nextCustomProperties); @@ -54,4 +41,8 @@ class Event extends EventBase { super.childRemoved(child); _syncCustomProperties(); } + + static final _UnknownEvent unknown = _UnknownEvent(); } + +class _UnknownEvent extends Event {} diff --git a/lib/src/rive_core/text/text.dart b/lib/src/rive_core/text/text.dart index eb02c57..6587346 100644 --- a/lib/src/rive_core/text/text.dart +++ b/lib/src/rive_core/text/text.dart @@ -104,6 +104,7 @@ class Text extends TextBase with TextStyleContainer { font: run.style?.font ?? defaultFont, fontSize: run.style?.fontSize ?? 16, lineHeight: run.style?.lineHeight ?? -1, + letterSpacing: run.style?.letterSpacing ?? 0, unicharCount: run.text.codeUnits.length, styleId: runIndex++, )); @@ -142,24 +143,6 @@ class Text extends TextBase with TextStyleContainer { return buffer.toString(); } - /// [defaultFont] will be removed when we add asset font options. - // TextShapeResult? shape(Font defaultFont) { - // if (_shape != null) { - // return _shape; - // } - // var styled = makeStyled(defaultFont); - // _shape = defaultFont.shape( - // styled.value, - // styled.runs, - // ); - // if (_modifierGroups.isNotEmpty && _shape != null) { - // _glyphLookup = GlyphLookup.fromShape(_shape!, styled.value.length); - // } else { - // _glyphLookup = null; - // } - // return _shape; - // } - void _disposeShape() { for (final shape in _cleanupShapes) { shape.dispose(); @@ -221,7 +204,6 @@ class Text extends TextBase with TextStyleContainer { return; } double y = 0; - double maxX = 0; var paragraphIndex = 0; for (final paragraphLines in lines) { @@ -237,9 +219,6 @@ class Text extends TextBase with TextStyleContainer { x += run.advanceAt(glyphInfo.index); } - if (x > maxX) { - maxX = x; - } } if (paragraphLines.isNotEmpty) { diff --git a/lib/src/rive_core/text/text_style.dart b/lib/src/rive_core/text/text_style.dart index 944e1e2..53965e5 100644 --- a/lib/src/rive_core/text/text_style.dart +++ b/lib/src/rive_core/text/text_style.dart @@ -100,6 +100,11 @@ class TextStyle extends TextStyleBase _markShapeDirty(); } + @override + void letterSpacingChanged(double from, double to) { + _markShapeDirty(); + } + void _markShapeDirty() { for (final run in _referencers) { run.markShapeDirty(); diff --git a/lib/src/rive_render_box.dart b/lib/src/rive_render_box.dart index 940afee..b52c2ed 100644 --- a/lib/src/rive_render_box.dart +++ b/lib/src/rive_render_box.dart @@ -5,20 +5,13 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:rive_common/math.dart'; -/// This allows a value of type T or T? -/// to be treated as a value of type T?. -/// -/// We use this so that APIs that have become -/// non-nullable can still be used with `!` and `?` -/// to support older versions of the API as well. -T? _ambiguate(T? value) => value; - abstract class RiveRenderBox extends RenderBox { - final Stopwatch _stopwatch = Stopwatch(); + Ticker? _ticker; BoxFit _fit = BoxFit.none; Alignment _alignment = Alignment.center; bool _useArtboardSize = false; Rect? _clipRect; + bool _tickerModeEnabled = true; bool _enableHitTests = false; bool get useArtboardSize => _useArtboardSize; @@ -74,6 +67,20 @@ abstract class RiveRenderBox extends RenderBox { } } + bool get tickerModeEnabled => _tickerModeEnabled; + + set tickerModeEnabled(bool value) { + if (value != _tickerModeEnabled) { + _tickerModeEnabled = value; + + if (_tickerModeEnabled) { + _startTicker(); + } else { + _stopTicker(); + } + } + } + bool get enableHitTests => _enableHitTests; set enableHitTests(bool value) { @@ -178,14 +185,49 @@ abstract class RiveRenderBox extends RenderBox { @override void detach() { - _stopwatch.stop(); + _stopTicker(); + super.detach(); } + @override + void dispose() { + _ticker?.dispose(); + _ticker = null; + + super.dispose(); + } + @override void attach(PipelineOwner owner) { super.attach(owner); - _stopwatch.start(); + + _ticker = Ticker(_frameCallback); + _startTicker(); + } + + void _stopTicker() { + _elapsedSeconds = 0; + _prevTickerElapsedInSeconds = 0; + + _ticker?.stop(); + } + + void _startTicker() { + _elapsedSeconds = 0; + _prevTickerElapsedInSeconds = 0; + + // Always ensure ticker is stopped before starting + if (_ticker?.isActive ?? false) { + _ticker?.stop(); + } + _ticker?.start(); + } + + void _restartTickerIfStopped() { + if (_ticker != null && !_ticker!.isActive) { + _startTicker(); + } } /// Get the Axis Aligned Bounding Box that encompasses the world space scene @@ -197,25 +239,28 @@ abstract class RiveRenderBox extends RenderBox { void afterDraw(Canvas canvas, Offset offset) {} + /// Time between frame callbacks double _elapsedSeconds = 0; + /// The total time [_ticker] has been active in seconds + double _prevTickerElapsedInSeconds = 0; + + void _calculateElapsedSeconds(Duration duration) { + final double tickerElapsedInSeconds = + duration.inMicroseconds.toDouble() / Duration.microsecondsPerSecond; + assert(tickerElapsedInSeconds >= 0.0); + + _elapsedSeconds = tickerElapsedInSeconds - _prevTickerElapsedInSeconds; + _prevTickerElapsedInSeconds = tickerElapsedInSeconds; + } + void _frameCallback(Duration duration) { - _elapsedSeconds = _stopwatch.elapsedTicks / _stopwatch.frequency; - _stopwatch.reset(); - _stopwatch.start(); + _calculateElapsedSeconds(duration); + markNeedsPaint(); } - int _frameCallbackId = -1; - - void scheduleRepaint() { - if (_frameCallbackId != -1) { - return; - } - _frameCallbackId = _ambiguate(SchedulerBinding.instance) - ?.scheduleFrameCallback(_frameCallback) ?? - -1; - } + void scheduleRepaint() => _restartTickerIfStopped(); /// Override this if you want to do custom viewTransform alignment. This will /// be called after advancing. Return true to prevent regular paint. @@ -305,11 +350,8 @@ abstract class RiveRenderBox extends RenderBox { @protected @override void paint(PaintingContext context, Offset offset) { - _frameCallbackId = -1; - if (advance(_elapsedSeconds)) { - scheduleRepaint(); - } else { - _stopwatch.stop(); + if (!advance(_elapsedSeconds)) { + _stopTicker(); } _elapsedSeconds = 0; diff --git a/pubspec.yaml b/pubspec.yaml index 6f6f968..f09ca9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: rive -version: 0.11.13 +version: 0.11.14 homepage: https://rive.app description: Rive 2 Flutter Runtime. This package provides runtime functionality for playing back and interacting with animations built with the Rive editor available at https://rive.app. repository: https://github.com/rive-app/rive-flutter @@ -21,7 +21,7 @@ dependencies: http: ^1.1.0 meta: ^1.3.0 plugin_platform_interface: ^2.0.2 - rive_common: 0.2.5 + rive_common: 0.2.6 dev_dependencies: flutter_test: sdk: flutter diff --git a/test/assets/cdn_image.riv b/test/assets/cdn_image.riv index ed6de3d..5b390ac 100644 Binary files a/test/assets/cdn_image.riv and b/test/assets/cdn_image.riv differ diff --git a/test/assets/file.png b/test/assets/file.png index 6a1856e..8a98dfa 100644 Binary files a/test/assets/file.png and b/test/assets/file.png differ diff --git a/test/assets/follow_path_shapes.riv b/test/assets/follow_path_shapes.riv new file mode 100644 index 0000000..626e303 --- /dev/null +++ b/test/assets/follow_path_shapes.riv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d2eea5391be368871ba71c5b6cf9b8b8a20fe3ac00f98a473c552e08208493c +size 2750 diff --git a/test/assets/image_asset_prod.riv b/test/assets/image_asset_prod.riv index 069d6a2..0693a0b 100644 Binary files a/test/assets/image_asset_prod.riv and b/test/assets/image_asset_prod.riv differ diff --git a/test/assets/image_asset_uat.riv b/test/assets/image_asset_uat.riv index 67547a5..22b7bfa 100644 Binary files a/test/assets/image_asset_uat.riv and b/test/assets/image_asset_uat.riv differ diff --git a/test/assets/joystick_handle_source.riv b/test/assets/joystick_handle_source.riv new file mode 100644 index 0000000..c23997b --- /dev/null +++ b/test/assets/joystick_handle_source.riv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc047f6e53f6f3c0a7d044a61faf9d15792c4cfedb14dc9f8f39307f7e29a7f9 +size 602 diff --git a/test/assets/off_road_car.riv b/test/assets/off_road_car.riv new file mode 100644 index 0000000..6f40ca9 --- /dev/null +++ b/test/assets/off_road_car.riv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2cf7f74416ebc7c1016dd6801d38ea6e80cd936fead3d7b6240a34110fda960 +size 34921 diff --git a/test/assets/rive-flutter-test-asset.riv b/test/assets/rive-flutter-test-asset.riv index a479184..3cf7110 100644 Binary files a/test/assets/rive-flutter-test-asset.riv and b/test/assets/rive-flutter-test-asset.riv differ diff --git a/test/assets/sample_image.riv b/test/assets/sample_image.riv index e0db652..ecb5bd2 100644 Binary files a/test/assets/sample_image.riv and b/test/assets/sample_image.riv differ diff --git a/test/assets/skins_demo.riv b/test/assets/skins_demo.riv new file mode 100644 index 0000000..b814e65 --- /dev/null +++ b/test/assets/skins_demo.riv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7b9bc316e5db9056ff6713ecedd07b304d9e19da9b8310b68369b92711946b2 +size 19672 diff --git a/test/goldens/follow_path/golden_follow_path_test.dart b/test/goldens/follow_path/golden_follow_path_test.dart new file mode 100644 index 0000000..844c9ad --- /dev/null +++ b/test/goldens/follow_path/golden_follow_path_test.dart @@ -0,0 +1,59 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:rive/rive.dart'; + +import '../../src/utils.dart'; +import '../golden_comparator.dart'; + +void main() { + group('Golden - follow path tests', () { + testWidgets('Follow path over time', (WidgetTester tester) async { + final riveBytes = loadFile('assets/follow_path_shapes.riv'); + final file = RiveFile.import(riveBytes); + late Artboard artboard; + + final widget = RiveAnimation.direct( + file, + stateMachines: const ['State Machine 1'], + onInit: (a) { + artboard = a; + }, + ); + await tester.pumpWidget(widget); + + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_over_time_01.png', + reason: 'Follow path should work as animation advances', + ); + + artboard.advance(0.1, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_over_time_02.png', + reason: 'Follow path should work as animation advances', + ); + + artboard.advance(0.1, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_over_time_03.png', + reason: 'Follow path should work as animation advances', + ); + + artboard.advance(0.1, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_over_time_04.png', + reason: 'Follow path should work as animation advances', + ); + }); + }); +} diff --git a/test/goldens/follow_path/images/follow_path_over_time_01.png b/test/goldens/follow_path/images/follow_path_over_time_01.png new file mode 100644 index 0000000..e154ecc --- /dev/null +++ b/test/goldens/follow_path/images/follow_path_over_time_01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d73f7540f870f1174ded7d9f6ffc04860193d0851a004876e89bb3a61c86495e +size 52458 diff --git a/test/goldens/follow_path/images/follow_path_over_time_02.png b/test/goldens/follow_path/images/follow_path_over_time_02.png new file mode 100644 index 0000000..b4408e7 --- /dev/null +++ b/test/goldens/follow_path/images/follow_path_over_time_02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60c03e85e9569c34575587d3a0d9e5a9dfba4b0666b37939106e0301aeb90a4a +size 55965 diff --git a/test/goldens/follow_path/images/follow_path_over_time_03.png b/test/goldens/follow_path/images/follow_path_over_time_03.png new file mode 100644 index 0000000..57561e8 --- /dev/null +++ b/test/goldens/follow_path/images/follow_path_over_time_03.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5d1984dbeb37bc8c86c21dbb6dde470e0e6f6d20647e25c34856ee45fff935a +size 55243 diff --git a/test/goldens/follow_path/images/follow_path_over_time_04.png b/test/goldens/follow_path/images/follow_path_over_time_04.png new file mode 100644 index 0000000..aa8dd14 --- /dev/null +++ b/test/goldens/follow_path/images/follow_path_over_time_04.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18889425564b9c6957fccf23ccd0cf8d03c589953769898bb76c8a6c596030a6 +size 54695 diff --git a/test/goldens/golden_comparator.dart b/test/goldens/golden_comparator.dart new file mode 100644 index 0000000..4e66cc5 --- /dev/null +++ b/test/goldens/golden_comparator.dart @@ -0,0 +1,62 @@ +import 'dart:developer'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:path/path.dart' as path; + +const _kGoldenDiffTolerance = 0.005; + +class AppFileComparator extends LocalFileComparator { + AppFileComparator(String testFile) : super(Uri.parse(testFile)); + + @override + Future compare(Uint8List imageBytes, Uri golden) async { + final result = await GoldenFileComparator.compareLists( + imageBytes, + await getGoldenBytes(golden), + ); + + if (!result.passed && result.diffPercent > _kGoldenDiffTolerance) { + final error = await generateFailureOutput(result, golden, basedir); + throw FlutterError(error); + } + if (!result.passed) { + log( + 'A tolerable difference of ${result.diffPercent * 100}% was found when ' + 'comparing $golden.', + ); + } + return result.passed || result.diffPercent <= _kGoldenDiffTolerance; + } +} + +/// Expect that the [actual] image matches the golden image identified by +/// [goldenFileKey]. +/// +/// This is a wrapper around [expectLater] and [matchesGoldenFile] that +/// automatically sets the [goldenFileComparator] to [AppFileComparator] and +/// sets the golden file path to `images/$goldenFileKey`. +/// +/// The tolerance for the difference between the golden and actual image is +/// set to [_kGoldenDiffTolerance] - 0.005. +Future expectGoldenMatches( + dynamic actual, + String goldenFileKey, { + String? reason, + bool skip = false, +}) { + final goldenPath = path.join('images', goldenFileKey); + goldenFileComparator = AppFileComparator( + path.join( + (goldenFileComparator as LocalFileComparator).basedir.toString(), + goldenFileKey, + ), + ); + + return expectLater( + actual, + matchesGoldenFile(goldenPath), + reason: reason, + skip: skip, + ); +} diff --git a/test/goldens/joysticks/golden_joysticks_test.dart b/test/goldens/joysticks/golden_joysticks_test.dart new file mode 100644 index 0000000..47ab837 --- /dev/null +++ b/test/goldens/joysticks/golden_joysticks_test.dart @@ -0,0 +1,64 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:rive/math.dart'; +import 'package:rive/rive.dart'; + +import '../../src/utils.dart'; +import '../golden_comparator.dart'; + +void main() { + group('Golden - Joystick tests', () { + // See: https://github.com/rive-app/rive/pull/5589 + testWidgets('Joystick handle source', (WidgetTester tester) async { + final riveBytes = loadFile('assets/joystick_handle_source.riv'); + final file = RiveFile.import(riveBytes); + late Artboard artboard; + late StateMachineController controller; + + final widget = RiveAnimation.direct( + file, + useArtboardSize: true, + onInit: (a) { + artboard = a; + controller = artboard.stateMachineByName('State Machine 1')!; + artboard.addController(controller); + }, + ); + await tester.pumpWidget(widget); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'joystick_handle_source_01.png', + reason: 'Handle source on joystick should be updated by listeners', + ); + + controller.pointerMove(Vec2D.fromValues(85, 60)); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'joystick_handle_source_02.png', + reason: 'Handle source on joystick should be updated by listeners', + ); + + controller.pointerMove(Vec2D.fromValues(370, 65)); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'joystick_handle_source_03.png', + reason: 'Handle source on joystick should be updated by listeners', + ); + + artboard.advance(0.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'joystick_handle_source_04.png', + reason: 'Handle source on joystick should be updated by listeners' + ' when advanding time', + ); + }); + }); +} diff --git a/test/goldens/joysticks/images/joystick_handle_source_01.png b/test/goldens/joysticks/images/joystick_handle_source_01.png new file mode 100644 index 0000000..c2457d9 --- /dev/null +++ b/test/goldens/joysticks/images/joystick_handle_source_01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7033a7b91597499e0dac1cd34e5dc79efa5534f2206cc4d62c276bcf6e3572b +size 21309 diff --git a/test/goldens/joysticks/images/joystick_handle_source_02.png b/test/goldens/joysticks/images/joystick_handle_source_02.png new file mode 100644 index 0000000..1f218b5 --- /dev/null +++ b/test/goldens/joysticks/images/joystick_handle_source_02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a11b4e9de03e22d28a22b3b67e046eb8ca6178168c6c0ab4950ff172f8c9bd7 +size 21277 diff --git a/test/goldens/joysticks/images/joystick_handle_source_03.png b/test/goldens/joysticks/images/joystick_handle_source_03.png new file mode 100644 index 0000000..83dfdb8 --- /dev/null +++ b/test/goldens/joysticks/images/joystick_handle_source_03.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf94631c5844f8083429297c57df3ca6c327d9ef9e594ede8d8a87844df4d941 +size 21277 diff --git a/test/goldens/joysticks/images/joystick_handle_source_04.png b/test/goldens/joysticks/images/joystick_handle_source_04.png new file mode 100644 index 0000000..7c873f3 --- /dev/null +++ b/test/goldens/joysticks/images/joystick_handle_source_04.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7292897e8e06676273624bc3231abe81fd8bb928a9659ae63b6e4a207c1ddcb2 +size 21282 diff --git a/test/goldens/simple_animations/golden_simple_animations_test.dart b/test/goldens/simple_animations/golden_simple_animations_test.dart new file mode 100644 index 0000000..33fb5dc --- /dev/null +++ b/test/goldens/simple_animations/golden_simple_animations_test.dart @@ -0,0 +1,96 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:rive/rive.dart'; + +import '../../src/utils.dart'; +import '../golden_comparator.dart'; + +void main() { + group('Golden - simple linear animations', () { + testWidgets('Play first animation found', (WidgetTester tester) async { + final riveBytes = loadFile('assets/off_road_car.riv'); + final file = RiveFile.import(riveBytes); + + await tester.pumpWidget(RiveAnimation.direct(file)); + + // Advance animation by one frame + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'play_first_animation_found.png', + reason: 'Animation should be advanced by one frame', + ); + }); + + testWidgets('Play provided animation controller', + (WidgetTester tester) async { + final riveBytes = loadFile('assets/off_road_car.riv'); + final file = RiveFile.import(riveBytes); + + final controller = SimpleAnimation('bouncing'); + + late Artboard artboard; + + await tester.pumpWidget(RiveAnimation.direct( + file, + controllers: [controller], + onInit: (a) { + artboard = a; + }, + )); + + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'play_provided_animation_controller_01.png', + reason: 'Simple animation should be advanced by one frame', + ); + + controller.apply(artboard as RuntimeArtboard, 1); + await tester.pump(); + await expectGoldenMatches( + find.byType(RiveAnimation), + 'play_provided_animation_controller_02.png', + reason: 'Simple animation should be advanced by one second', + ); + }); + + testWidgets('Mixed animations', (WidgetTester tester) async { + final riveBytes = loadFile('assets/off_road_car.riv'); + final file = RiveFile.import(riveBytes); + + final controllerIdle = SimpleAnimation('idle'); + final controllerBouncing = SimpleAnimation('bouncing'); + final controllerWipers = SimpleAnimation('windshield_wipers'); + + late Artboard artboard; + + await tester.pumpWidget(RiveAnimation.direct( + file, + controllers: [controllerIdle, controllerBouncing, controllerWipers], + onInit: (a) { + artboard = a; + }, + )); + + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'mixed_animations_01.png', + reason: 'Mixed animations should be advanced by one frame', + ); + + controllerIdle.apply(artboard as RuntimeArtboard, 0.5); + controllerBouncing.apply(artboard as RuntimeArtboard, 0.5); + controllerWipers.apply(artboard as RuntimeArtboard, 0.5); + await tester.pump(); + await expectGoldenMatches( + find.byType(RiveAnimation), + 'mixed_animations_02.png', + reason: 'Mixed animations should be advanced by half a second', + ); + }); + }); +} diff --git a/test/goldens/simple_animations/images/mixed_animations_01.png b/test/goldens/simple_animations/images/mixed_animations_01.png new file mode 100644 index 0000000..299a26c --- /dev/null +++ b/test/goldens/simple_animations/images/mixed_animations_01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b60ba5404987179dd479b523aacb8d07ecb73be50a93da16c6002c684d8131cc +size 234719 diff --git a/test/goldens/simple_animations/images/mixed_animations_02.png b/test/goldens/simple_animations/images/mixed_animations_02.png new file mode 100644 index 0000000..5272fb1 --- /dev/null +++ b/test/goldens/simple_animations/images/mixed_animations_02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:385148a3247e9e920014d18cecf1c7ed94fceb5d0c909e8cad2b66637737b130 +size 220555 diff --git a/test/goldens/simple_animations/images/play_first_animation_found.png b/test/goldens/simple_animations/images/play_first_animation_found.png new file mode 100644 index 0000000..abdf980 --- /dev/null +++ b/test/goldens/simple_animations/images/play_first_animation_found.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72834e009c5682178d486e1bcf45687750d125b2789341e8e136cdd58bb07271 +size 205171 diff --git a/test/goldens/simple_animations/images/play_provided_animation_controller_01.png b/test/goldens/simple_animations/images/play_provided_animation_controller_01.png new file mode 100644 index 0000000..747ca66 --- /dev/null +++ b/test/goldens/simple_animations/images/play_provided_animation_controller_01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d62812f6b02c9399c2e2be41c4e7aa2ce336c4c855f49fd9cce08ed82287fa71 +size 237792 diff --git a/test/goldens/simple_animations/images/play_provided_animation_controller_02.png b/test/goldens/simple_animations/images/play_provided_animation_controller_02.png new file mode 100644 index 0000000..d9d1978 --- /dev/null +++ b/test/goldens/simple_animations/images/play_provided_animation_controller_02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e971f302901521bd4702728af8817e81882f9cce6c9feaf5b9369450628a5a03 +size 217518 diff --git a/test/goldens/skins_opacity/golden_skins_opacity_test.dart b/test/goldens/skins_opacity/golden_skins_opacity_test.dart new file mode 100644 index 0000000..f68671d --- /dev/null +++ b/test/goldens/skins_opacity/golden_skins_opacity_test.dart @@ -0,0 +1,82 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:rive/rive.dart'; + +import '../../src/utils.dart'; +import '../golden_comparator.dart'; + +void main() { + group('Golden - solo animations', () { + testWidgets('Play first animation found', (WidgetTester tester) async { + final riveBytes = loadFile('assets/skins_demo.riv'); + final file = RiveFile.import(riveBytes); + late SMITrigger trigger; + late Artboard artboard; + late StateMachineController controller; + + final widget = RiveAnimation.direct( + file, + onInit: (a) { + artboard = a; + controller = StateMachineController.fromArtboard( + artboard, + 'Motion', + )!; + controller.isActive = false; + artboard.addController(controller); + trigger = controller.findInput('Skin') as SMITrigger; + }, + ); + + await tester.pumpWidget(widget); + trigger.fire(); + artboard.advance(0.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'skins_opacity_01.png', + reason: 'Skins (opacity/animation) should be swapped', + ); + + trigger.fire(); + artboard.advance(0.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'skins_opacity_02.png', + reason: 'Skins (opacity/animation) should be swapped', + ); + + trigger.fire(); + artboard.advance(0.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'skins_opacity_03.png', + reason: 'Skins (opacity/animation) should be swapped', + ); + + trigger.fire(); + artboard.advance(0.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'skins_opacity_04.png', + reason: 'Skins (opacity/animation) should be swapped', + ); + + trigger.fire(); + artboard.advance(0.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'skins_opacity_05.png', + reason: 'Skins (opacity/animation) should be swapped', + ); + }); + }); +} diff --git a/test/goldens/skins_opacity/images/skins_opacity_01.png b/test/goldens/skins_opacity/images/skins_opacity_01.png new file mode 100644 index 0000000..f35ed43 --- /dev/null +++ b/test/goldens/skins_opacity/images/skins_opacity_01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58003f586200c4c4c467599a1b56194cd74c85e8971f479e6714aef7e6e3b9a5 +size 25538 diff --git a/test/goldens/skins_opacity/images/skins_opacity_02.png b/test/goldens/skins_opacity/images/skins_opacity_02.png new file mode 100644 index 0000000..84d3e67 --- /dev/null +++ b/test/goldens/skins_opacity/images/skins_opacity_02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:703ee942f4d9e8c7ed0473de52fcad51aa3b45ab3bad5a1899646902aff1ee39 +size 27077 diff --git a/test/goldens/skins_opacity/images/skins_opacity_03.png b/test/goldens/skins_opacity/images/skins_opacity_03.png new file mode 100644 index 0000000..b730638 --- /dev/null +++ b/test/goldens/skins_opacity/images/skins_opacity_03.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5e75d028115f4c48cbf3ae9eef5d08c5aafe8a3cf91744be3d9aa9ad81c0d50 +size 30939 diff --git a/test/goldens/skins_opacity/images/skins_opacity_04.png b/test/goldens/skins_opacity/images/skins_opacity_04.png new file mode 100644 index 0000000..87c32f5 --- /dev/null +++ b/test/goldens/skins_opacity/images/skins_opacity_04.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b99ed3b71ad0022d5e9a7b68f131f422723f977cc0ce0b0e2345d4413629286d +size 28122 diff --git a/test/goldens/skins_opacity/images/skins_opacity_05.png b/test/goldens/skins_opacity/images/skins_opacity_05.png new file mode 100644 index 0000000..0978f58 --- /dev/null +++ b/test/goldens/skins_opacity/images/skins_opacity_05.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b10f4c5f7d21786c7272080e73edd440474098e4d8e0317e9805d26ea1728e2 +size 35336 diff --git a/update_dependencies.sh b/update_dependencies.sh index aef068a..e97720f 100755 --- a/update_dependencies.sh +++ b/update_dependencies.sh @@ -24,8 +24,6 @@ function installRiveCpp { echo "Getting rive-cpp from current repo." export INSTALL_TO=$PWD mkdir -p rive-cpp - # cp -fR ../../runtime rive-cpp - # git clone machine1:/path/to/project machine2:/target/path pushd ../../runtime function copyRepoFile {