mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-23 15:29:20 +08:00
Updating for latest rive editor changes (events & nested animation sync).
This commit is contained in:
@ -22,6 +22,7 @@ export 'package:rive/src/core/importers/state_machine_importer.dart';
|
||||
export 'package:rive/src/core/importers/state_machine_layer_importer.dart';
|
||||
export 'package:rive/src/core/importers/state_machine_listener_importer.dart';
|
||||
export 'package:rive/src/core/importers/state_transition_importer.dart';
|
||||
export 'package:rive/src/event_list.dart';
|
||||
export 'package:rive/src/generated/rive_core_context.dart';
|
||||
export 'package:rive/src/listener_actions.dart';
|
||||
export 'package:rive/src/runtime_artboard.dart';
|
||||
|
20
lib/src/event_list.dart
Normal file
20
lib/src/event_list.dart
Normal file
@ -0,0 +1,20 @@
|
||||
import 'dart:collection';
|
||||
import 'package:rive/src/rive_core/event.dart';
|
||||
|
||||
class EventList extends ListBase<Event> {
|
||||
// Lame way to do this due to how ListBase needs to expand a nullable list.
|
||||
final List<Event?> _values = [];
|
||||
List<Event> get values => _values.cast<Event>();
|
||||
|
||||
@override
|
||||
int get length => _values.length;
|
||||
|
||||
@override
|
||||
set length(int value) => _values.length = value;
|
||||
|
||||
@override
|
||||
Event operator [](int index) => _values[index]!;
|
||||
|
||||
@override
|
||||
void operator []=(int index, Event value) => _values[index] = value;
|
||||
}
|
43
lib/src/generated/custom_property_boolean_base.dart
Normal file
43
lib/src/generated/custom_property_boolean_base.dart
Normal file
@ -0,0 +1,43 @@
|
||||
/// Core automatically generated
|
||||
/// lib/src/generated/custom_property_boolean_base.dart.
|
||||
/// Do not modify manually.
|
||||
|
||||
import 'package:rive/src/rive_core/component.dart';
|
||||
|
||||
abstract class CustomPropertyBooleanBase extends Component {
|
||||
static const int typeKey = 129;
|
||||
@override
|
||||
int get coreType => CustomPropertyBooleanBase.typeKey;
|
||||
@override
|
||||
Set<int> get coreTypes =>
|
||||
{CustomPropertyBooleanBase.typeKey, ComponentBase.typeKey};
|
||||
|
||||
/// --------------------------------------------------------------------------
|
||||
/// PropertyValue field with key 245.
|
||||
static const bool propertyValueInitialValue = false;
|
||||
bool _propertyValue = propertyValueInitialValue;
|
||||
static const int propertyValuePropertyKey = 245;
|
||||
bool get propertyValue => _propertyValue;
|
||||
|
||||
/// Change the [_propertyValue] field value.
|
||||
/// [propertyValueChanged] will be invoked only if the field's value has
|
||||
/// changed.
|
||||
set propertyValue(bool value) {
|
||||
if (_propertyValue == value) {
|
||||
return;
|
||||
}
|
||||
bool from = _propertyValue;
|
||||
_propertyValue = value;
|
||||
if (hasValidated) {
|
||||
propertyValueChanged(from, value);
|
||||
}
|
||||
}
|
||||
|
||||
void propertyValueChanged(bool from, bool to);
|
||||
|
||||
@override
|
||||
void copy(covariant CustomPropertyBooleanBase source) {
|
||||
super.copy(source);
|
||||
_propertyValue = source._propertyValue;
|
||||
}
|
||||
}
|
43
lib/src/generated/custom_property_number_base.dart
Normal file
43
lib/src/generated/custom_property_number_base.dart
Normal file
@ -0,0 +1,43 @@
|
||||
/// Core automatically generated
|
||||
/// lib/src/generated/custom_property_number_base.dart.
|
||||
/// Do not modify manually.
|
||||
|
||||
import 'package:rive/src/rive_core/component.dart';
|
||||
|
||||
abstract class CustomPropertyNumberBase extends Component {
|
||||
static const int typeKey = 127;
|
||||
@override
|
||||
int get coreType => CustomPropertyNumberBase.typeKey;
|
||||
@override
|
||||
Set<int> get coreTypes =>
|
||||
{CustomPropertyNumberBase.typeKey, ComponentBase.typeKey};
|
||||
|
||||
/// --------------------------------------------------------------------------
|
||||
/// PropertyValue field with key 243.
|
||||
static const double propertyValueInitialValue = 0;
|
||||
double _propertyValue = propertyValueInitialValue;
|
||||
static const int propertyValuePropertyKey = 243;
|
||||
double get propertyValue => _propertyValue;
|
||||
|
||||
/// Change the [_propertyValue] field value.
|
||||
/// [propertyValueChanged] will be invoked only if the field's value has
|
||||
/// changed.
|
||||
set propertyValue(double value) {
|
||||
if (_propertyValue == value) {
|
||||
return;
|
||||
}
|
||||
double from = _propertyValue;
|
||||
_propertyValue = value;
|
||||
if (hasValidated) {
|
||||
propertyValueChanged(from, value);
|
||||
}
|
||||
}
|
||||
|
||||
void propertyValueChanged(double from, double to);
|
||||
|
||||
@override
|
||||
void copy(covariant CustomPropertyNumberBase source) {
|
||||
super.copy(source);
|
||||
_propertyValue = source._propertyValue;
|
||||
}
|
||||
}
|
43
lib/src/generated/custom_property_string_base.dart
Normal file
43
lib/src/generated/custom_property_string_base.dart
Normal file
@ -0,0 +1,43 @@
|
||||
/// Core automatically generated
|
||||
/// lib/src/generated/custom_property_string_base.dart.
|
||||
/// Do not modify manually.
|
||||
|
||||
import 'package:rive/src/rive_core/component.dart';
|
||||
|
||||
abstract class CustomPropertyStringBase extends Component {
|
||||
static const int typeKey = 130;
|
||||
@override
|
||||
int get coreType => CustomPropertyStringBase.typeKey;
|
||||
@override
|
||||
Set<int> get coreTypes =>
|
||||
{CustomPropertyStringBase.typeKey, ComponentBase.typeKey};
|
||||
|
||||
/// --------------------------------------------------------------------------
|
||||
/// PropertyValue field with key 246.
|
||||
static const String propertyValueInitialValue = '';
|
||||
String _propertyValue = propertyValueInitialValue;
|
||||
static const int propertyValuePropertyKey = 246;
|
||||
String get propertyValue => _propertyValue;
|
||||
|
||||
/// Change the [_propertyValue] field value.
|
||||
/// [propertyValueChanged] will be invoked only if the field's value has
|
||||
/// changed.
|
||||
set propertyValue(String value) {
|
||||
if (_propertyValue == value) {
|
||||
return;
|
||||
}
|
||||
String from = _propertyValue;
|
||||
_propertyValue = value;
|
||||
if (hasValidated) {
|
||||
propertyValueChanged(from, value);
|
||||
}
|
||||
}
|
||||
|
||||
void propertyValueChanged(String from, String to);
|
||||
|
||||
@override
|
||||
void copy(covariant CustomPropertyStringBase source) {
|
||||
super.copy(source);
|
||||
_propertyValue = source._propertyValue;
|
||||
}
|
||||
}
|
48
lib/src/generated/event_base.dart
Normal file
48
lib/src/generated/event_base.dart
Normal file
@ -0,0 +1,48 @@
|
||||
/// Core automatically generated lib/src/generated/event_base.dart.
|
||||
/// Do not modify manually.
|
||||
|
||||
import 'package:rive/src/generated/component_base.dart';
|
||||
import 'package:rive/src/generated/container_component_base.dart';
|
||||
import 'package:rive/src/rive_core/container_component.dart';
|
||||
|
||||
abstract class EventBase extends ContainerComponent {
|
||||
static const int typeKey = 128;
|
||||
@override
|
||||
int get coreType => EventBase.typeKey;
|
||||
@override
|
||||
Set<int> get coreTypes => {
|
||||
EventBase.typeKey,
|
||||
ContainerComponentBase.typeKey,
|
||||
ComponentBase.typeKey
|
||||
};
|
||||
|
||||
/// --------------------------------------------------------------------------
|
||||
/// Type field with key 244.
|
||||
static const String typeInitialValue = '';
|
||||
String _type = typeInitialValue;
|
||||
static const int typePropertyKey = 244;
|
||||
|
||||
/// Intent of the event.
|
||||
String get type => _type;
|
||||
|
||||
/// Change the [_type] field value.
|
||||
/// [typeChanged] will be invoked only if the field's value has changed.
|
||||
set type(String value) {
|
||||
if (_type == value) {
|
||||
return;
|
||||
}
|
||||
String from = _type;
|
||||
_type = value;
|
||||
if (hasValidated) {
|
||||
typeChanged(from, value);
|
||||
}
|
||||
}
|
||||
|
||||
void typeChanged(String from, String to);
|
||||
|
||||
@override
|
||||
void copy(covariant EventBase source) {
|
||||
super.copy(source);
|
||||
_type = source._type;
|
||||
}
|
||||
}
|
@ -87,8 +87,12 @@ import 'package:rive/src/rive_core/constraints/rotation_constraint.dart';
|
||||
import 'package:rive/src/rive_core/constraints/scale_constraint.dart';
|
||||
import 'package:rive/src/rive_core/constraints/transform_constraint.dart';
|
||||
import 'package:rive/src/rive_core/constraints/translation_constraint.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/draw_rules.dart';
|
||||
import 'package:rive/src/rive_core/draw_target.dart';
|
||||
import 'package:rive/src/rive_core/event.dart';
|
||||
import 'package:rive/src/rive_core/nested_artboard.dart';
|
||||
import 'package:rive/src/rive_core/node.dart';
|
||||
import 'package:rive/src/rive_core/shapes/clipping_shape.dart';
|
||||
@ -121,6 +125,8 @@ class RiveCoreContext {
|
||||
switch (typeKey) {
|
||||
case DrawTargetBase.typeKey:
|
||||
return DrawTarget();
|
||||
case CustomPropertyNumberBase.typeKey:
|
||||
return CustomPropertyNumber();
|
||||
case DistanceConstraintBase.typeKey:
|
||||
return DistanceConstraint();
|
||||
case IKConstraintBase.typeKey:
|
||||
@ -263,8 +269,12 @@ class RiveCoreContext {
|
||||
return Image();
|
||||
case CubicDetachedVertexBase.typeKey:
|
||||
return CubicDetachedVertex();
|
||||
case EventBase.typeKey:
|
||||
return Event();
|
||||
case DrawRulesBase.typeKey:
|
||||
return DrawRules();
|
||||
case CustomPropertyBooleanBase.typeKey:
|
||||
return CustomPropertyBoolean();
|
||||
case ArtboardBase.typeKey:
|
||||
return Artboard();
|
||||
case BackboardBase.typeKey:
|
||||
@ -277,6 +287,8 @@ class RiveCoreContext {
|
||||
return Skin();
|
||||
case TendonBase.typeKey:
|
||||
return Tendon();
|
||||
case CustomPropertyStringBase.typeKey:
|
||||
return CustomPropertyString();
|
||||
case FolderBase.typeKey:
|
||||
return Folder();
|
||||
case ImageAssetBase.typeKey:
|
||||
@ -310,6 +322,11 @@ class RiveCoreContext {
|
||||
object.placementValue = value;
|
||||
}
|
||||
break;
|
||||
case CustomPropertyNumberBase.propertyValuePropertyKey:
|
||||
if (object is CustomPropertyNumberBase && value is double) {
|
||||
object.propertyValue = value;
|
||||
}
|
||||
break;
|
||||
case ConstraintBase.strengthPropertyKey:
|
||||
if (object is ConstraintBase && value is double) {
|
||||
object.strength = value;
|
||||
@ -1005,11 +1022,21 @@ class RiveCoreContext {
|
||||
object.outDistance = value;
|
||||
}
|
||||
break;
|
||||
case EventBase.typePropertyKey:
|
||||
if (object is EventBase && value is String) {
|
||||
object.type = value;
|
||||
}
|
||||
break;
|
||||
case DrawRulesBase.drawTargetIdPropertyKey:
|
||||
if (object is DrawRulesBase && value is int) {
|
||||
object.drawTargetId = value;
|
||||
}
|
||||
break;
|
||||
case CustomPropertyBooleanBase.propertyValuePropertyKey:
|
||||
if (object is CustomPropertyBooleanBase && value is bool) {
|
||||
object.propertyValue = value;
|
||||
}
|
||||
break;
|
||||
case ArtboardBase.clipPropertyKey:
|
||||
if (object is ArtboardBase && value is bool) {
|
||||
object.clip = value;
|
||||
@ -1130,6 +1157,11 @@ class RiveCoreContext {
|
||||
object.ty = value;
|
||||
}
|
||||
break;
|
||||
case CustomPropertyStringBase.propertyValuePropertyKey:
|
||||
if (object is CustomPropertyStringBase && value is String) {
|
||||
object.propertyValue = value;
|
||||
}
|
||||
break;
|
||||
case AssetBase.namePropertyKey:
|
||||
if (object is AssetBase && value is String) {
|
||||
object.name = value;
|
||||
@ -1169,6 +1201,8 @@ class RiveCoreContext {
|
||||
case ComponentBase.namePropertyKey:
|
||||
case AnimationBase.namePropertyKey:
|
||||
case StateMachineComponentBase.namePropertyKey:
|
||||
case EventBase.typePropertyKey:
|
||||
case CustomPropertyStringBase.propertyValuePropertyKey:
|
||||
case AssetBase.namePropertyKey:
|
||||
return stringType;
|
||||
case ComponentBase.parentIdPropertyKey:
|
||||
@ -1232,6 +1266,7 @@ class RiveCoreContext {
|
||||
case TendonBase.boneIdPropertyKey:
|
||||
case FileAssetBase.assetIdPropertyKey:
|
||||
return uintType;
|
||||
case CustomPropertyNumberBase.propertyValuePropertyKey:
|
||||
case ConstraintBase.strengthPropertyKey:
|
||||
case DistanceConstraintBase.distancePropertyKey:
|
||||
case TransformComponentConstraintBase.copyFactorPropertyKey:
|
||||
@ -1336,6 +1371,7 @@ class RiveCoreContext {
|
||||
case PointsPathBase.isClosedPropertyKey:
|
||||
case RectangleBase.linkCornerRadiusPropertyKey:
|
||||
case ClippingShapeBase.isVisiblePropertyKey:
|
||||
case CustomPropertyBooleanBase.propertyValuePropertyKey:
|
||||
case ArtboardBase.clipPropertyKey:
|
||||
return boolType;
|
||||
case KeyFrameColorBase.valuePropertyKey:
|
||||
@ -1358,6 +1394,10 @@ class RiveCoreContext {
|
||||
return (object as AnimationBase).name;
|
||||
case StateMachineComponentBase.namePropertyKey:
|
||||
return (object as StateMachineComponentBase).name;
|
||||
case EventBase.typePropertyKey:
|
||||
return (object as EventBase).type;
|
||||
case CustomPropertyStringBase.propertyValuePropertyKey:
|
||||
return (object as CustomPropertyStringBase).propertyValue;
|
||||
case AssetBase.namePropertyKey:
|
||||
return (object as AssetBase).name;
|
||||
}
|
||||
@ -1492,6 +1532,8 @@ class RiveCoreContext {
|
||||
|
||||
static double getDouble(Core object, int propertyKey) {
|
||||
switch (propertyKey) {
|
||||
case CustomPropertyNumberBase.propertyValuePropertyKey:
|
||||
return (object as CustomPropertyNumberBase).propertyValue;
|
||||
case ConstraintBase.strengthPropertyKey:
|
||||
return (object as ConstraintBase).strength;
|
||||
case DistanceConstraintBase.distancePropertyKey:
|
||||
@ -1704,6 +1746,8 @@ class RiveCoreContext {
|
||||
return (object as RectangleBase).linkCornerRadius;
|
||||
case ClippingShapeBase.isVisiblePropertyKey:
|
||||
return (object as ClippingShapeBase).isVisible;
|
||||
case CustomPropertyBooleanBase.propertyValuePropertyKey:
|
||||
return (object as CustomPropertyBooleanBase).propertyValue;
|
||||
case ArtboardBase.clipPropertyKey:
|
||||
return (object as ArtboardBase).clip;
|
||||
}
|
||||
@ -1749,6 +1793,16 @@ class RiveCoreContext {
|
||||
object.name = value;
|
||||
}
|
||||
break;
|
||||
case EventBase.typePropertyKey:
|
||||
if (object is EventBase) {
|
||||
object.type = value;
|
||||
}
|
||||
break;
|
||||
case CustomPropertyStringBase.propertyValuePropertyKey:
|
||||
if (object is CustomPropertyStringBase) {
|
||||
object.propertyValue = value;
|
||||
}
|
||||
break;
|
||||
case AssetBase.namePropertyKey:
|
||||
if (object is AssetBase) {
|
||||
object.name = value;
|
||||
@ -2064,6 +2118,11 @@ class RiveCoreContext {
|
||||
|
||||
static void setDouble(Core object, int propertyKey, double value) {
|
||||
switch (propertyKey) {
|
||||
case CustomPropertyNumberBase.propertyValuePropertyKey:
|
||||
if (object is CustomPropertyNumberBase) {
|
||||
object.propertyValue = value;
|
||||
}
|
||||
break;
|
||||
case ConstraintBase.strengthPropertyKey:
|
||||
if (object is ConstraintBase) {
|
||||
object.strength = value;
|
||||
@ -2584,6 +2643,11 @@ class RiveCoreContext {
|
||||
object.isVisible = value;
|
||||
}
|
||||
break;
|
||||
case CustomPropertyBooleanBase.propertyValuePropertyKey:
|
||||
if (object is CustomPropertyBooleanBase) {
|
||||
object.propertyValue = value;
|
||||
}
|
||||
break;
|
||||
case ArtboardBase.clipPropertyKey:
|
||||
if (object is ArtboardBase) {
|
||||
object.clip = value;
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
abstract class Interpolator {
|
||||
int get id;
|
||||
|
||||
|
@ -6,7 +6,6 @@ export 'package:rive/src/generated/animation/nested_linear_animation_base.dart';
|
||||
/// Need this abstraction to not depend on package:rive in rive_core.
|
||||
// ignore: one_member_abstracts
|
||||
abstract class NestedLinearAnimationInstance {
|
||||
bool needsApply = true;
|
||||
void goto(double value);
|
||||
double get durationSeconds;
|
||||
|
||||
@ -37,15 +36,12 @@ abstract class NestedLinearAnimation extends NestedLinearAnimationBase {
|
||||
bool get isEnabled => true;
|
||||
|
||||
@override
|
||||
void mixChanged(double from, double to) {
|
||||
linearAnimationInstance?.needsApply = true;
|
||||
}
|
||||
void mixChanged(double from, double to) {}
|
||||
|
||||
@override
|
||||
bool advance(double elapsedSeconds, MountedArtboard mountedArtboard) {
|
||||
if (linearAnimationInstance?.needsApply ?? false) {
|
||||
if (linearAnimationInstance != null) {
|
||||
linearAnimationInstance!.apply(mountedArtboard, mix);
|
||||
linearAnimationInstance!.needsApply = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -11,6 +11,7 @@ import 'package:rive/src/rive_core/component_dirt.dart';
|
||||
import 'package:rive/src/rive_core/draw_rules.dart';
|
||||
import 'package:rive/src/rive_core/draw_target.dart';
|
||||
import 'package:rive/src/rive_core/drawable.dart';
|
||||
import 'package:rive/src/rive_core/event.dart';
|
||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||
import 'package:rive/src/rive_core/nested_artboard.dart';
|
||||
import 'package:rive/src/rive_core/rive_animation_controller.dart';
|
||||
@ -76,10 +77,14 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
|
||||
List<Drawable> get drawables => _drawables;
|
||||
|
||||
final AnimationList _animations = AnimationList();
|
||||
final EventList _events = EventList();
|
||||
|
||||
/// List of animations and state machines in the artboard.
|
||||
AnimationList get animations => _animations;
|
||||
|
||||
/// List of events in the artboard.
|
||||
EventList get events => _events;
|
||||
|
||||
/// List of linear animations in the artboard.
|
||||
Iterable<LinearAnimation> get linearAnimations =>
|
||||
_animations.whereType<LinearAnimation>();
|
||||
@ -359,6 +364,25 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
|
||||
return removed;
|
||||
}
|
||||
|
||||
/// Called by rive_core to add an Event to an Artboard. This should be
|
||||
/// @internal when it's supported.
|
||||
bool internalAddEvent(Event event) {
|
||||
if (_events.contains(event)) {
|
||||
return false;
|
||||
}
|
||||
_events.add(event);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Called by rive_core to remove an Event from an Artboard. This should
|
||||
/// be @internal when it's supported.
|
||||
bool internalRemoveEvent(Event event) {
|
||||
bool removed = _events.remove(event);
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
/// The animation controllers that are called back whenever the artboard
|
||||
/// advances.
|
||||
final Set<RiveAnimationController> _animationControllers = {};
|
||||
|
@ -3,14 +3,9 @@ import 'package:rive/src/generated/assets/drawable_asset_base.dart';
|
||||
export 'package:rive/src/generated/assets/drawable_asset_base.dart';
|
||||
|
||||
abstract class DrawableAsset extends DrawableAssetBase {
|
||||
DrawableAsset();
|
||||
|
||||
@override
|
||||
void heightChanged(double from, double to) {}
|
||||
|
||||
@override
|
||||
void widthChanged(double from, double to) {}
|
||||
|
||||
@override
|
||||
void assetIdChanged(int from, int to) {}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ class ImageAsset extends ImageAssetBase {
|
||||
if (_image == image) {
|
||||
return;
|
||||
}
|
||||
|
||||
_image = image;
|
||||
}
|
||||
|
||||
@ -39,8 +38,10 @@ class ImageAsset extends ImageAssetBase {
|
||||
..asset = this
|
||||
..name = name;
|
||||
|
||||
/// The editor works with images as PNGs, even if their sources may have come
|
||||
/// from other formats.
|
||||
static final imageExtensions = ['png', 'webp', 'jpeg'];
|
||||
|
||||
@override
|
||||
String get fileExtension => 'png';
|
||||
String get fileExtension => imageExtensions[format];
|
||||
|
||||
int get format => 0;
|
||||
}
|
||||
|
@ -55,7 +55,9 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
|
||||
|
||||
// Note that this isn't a setter as we don't want anything externally changing
|
||||
// the artboard.
|
||||
void _changeArtboard(Artboard? value) {
|
||||
@protected
|
||||
@mustCallSuper
|
||||
void changeArtboard(Artboard? value) {
|
||||
if (_artboard == value) {
|
||||
return;
|
||||
}
|
||||
@ -79,11 +81,11 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
|
||||
curr = curr.parent, sanity--) {
|
||||
visitAncestor(curr);
|
||||
if (curr is Artboard) {
|
||||
_changeArtboard(curr);
|
||||
changeArtboard(curr);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_changeArtboard(null);
|
||||
changeArtboard(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -222,7 +224,7 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
|
||||
|
||||
if (artboard != null) {
|
||||
context.markDependencyOrderDirty();
|
||||
_changeArtboard(null);
|
||||
changeArtboard(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
11
lib/src/rive_core/custom_property_boolean.dart
Normal file
11
lib/src/rive_core/custom_property_boolean.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:rive/src/generated/custom_property_boolean_base.dart';
|
||||
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) {}
|
||||
}
|
11
lib/src/rive_core/custom_property_number.dart
Normal file
11
lib/src/rive_core/custom_property_number.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:rive/src/generated/custom_property_number_base.dart';
|
||||
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) {}
|
||||
}
|
11
lib/src/rive_core/custom_property_string.dart
Normal file
11
lib/src/rive_core/custom_property_string.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:rive/src/generated/custom_property_string_base.dart';
|
||||
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) {}
|
||||
}
|
@ -1,7 +1,19 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:rive/src/generated/event_base.dart';
|
||||
import 'package:rive/src/rive_core/artboard.dart';
|
||||
|
||||
// Just a way to get around the protected notifyListeners so we can use trigger
|
||||
// multiple events from a single object.
|
||||
class Event extends ChangeNotifier {
|
||||
void notify() => notifyListeners();
|
||||
export 'package:rive/src/generated/event_base.dart';
|
||||
|
||||
class Event extends EventBase {
|
||||
@override
|
||||
void typeChanged(String from, String to) {}
|
||||
|
||||
@override
|
||||
void update(int dirt) {}
|
||||
|
||||
@override
|
||||
void changeArtboard(Artboard? value) {
|
||||
artboard?.internalRemoveEvent(this);
|
||||
super.changeArtboard(value);
|
||||
artboard?.internalAddEvent(this);
|
||||
}
|
||||
}
|
||||
|
7
lib/src/rive_core/notifier.dart
Normal file
7
lib/src/rive_core/notifier.dart
Normal file
@ -0,0 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
// Just a way to get around the protected notifyListeners so we can use trigger
|
||||
// multiple events from a single object.
|
||||
class Notifier extends ChangeNotifier {
|
||||
void notify() => notifyListeners();
|
||||
}
|
@ -43,7 +43,9 @@ class Image extends ImageBase
|
||||
}
|
||||
bool clipped = clip(canvas);
|
||||
|
||||
final paint = ui.Paint()..color = ui.Color.fromRGBO(0, 0, 0, renderOpacity);
|
||||
final paint = ui.Paint()
|
||||
..color = ui.Color.fromRGBO(0, 0, 0, renderOpacity)
|
||||
..filterQuality = ui.FilterQuality.high;
|
||||
|
||||
final width = asset!.width;
|
||||
final height = asset!.height;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:rive/rive.dart';
|
||||
import 'package:rive/src/core/core.dart';
|
||||
import 'package:rive/src/rive_core/component.dart';
|
||||
import 'package:rive/src/rive_core/event.dart';
|
||||
import 'package:rive/src/rive_core/notifier.dart';
|
||||
|
||||
/// Adds getters for linear animations and state machines
|
||||
extension RuntimeArtboardGetters on RuntimeArtboard {
|
||||
@ -18,7 +18,7 @@ extension RuntimeArtboardGetters on RuntimeArtboard {
|
||||
/// directly referenced. Use the Artboard type for any direct interactions with
|
||||
/// an artboard, and use extension methods to add functionality to Artboard.
|
||||
class RuntimeArtboard extends Artboard implements CoreContext {
|
||||
final _redraw = Event();
|
||||
final _redraw = Notifier();
|
||||
ChangeNotifier get redraw => _redraw;
|
||||
|
||||
/// Note that objects must be nullable as some may not resolve during load due
|
||||
|
@ -72,7 +72,6 @@ class RuntimeNestedLinearAnimationInstance
|
||||
|
||||
@override
|
||||
bool advance(double elapsedSeconds) {
|
||||
needsApply = true;
|
||||
linearAnimation.advance(elapsedSeconds * speed);
|
||||
return linearAnimation.keepGoing;
|
||||
}
|
||||
@ -86,7 +85,6 @@ class RuntimeNestedLinearAnimationInstance
|
||||
if (localTime == linearAnimation.time) {
|
||||
return;
|
||||
}
|
||||
needsApply = true;
|
||||
linearAnimation.time = localTime;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user