Run core generators

Need to get these in before we publish rive_flutter.

Diffs=
8785b0ff7 Run core generators (#6761)
e62a93370 fix text not updating when style changes (#6743)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
philter
2024-03-07 16:27:26 +00:00
parent a273bc837e
commit f3ec042a47
21 changed files with 51 additions and 32 deletions

View File

@@ -1 +1 @@
a1532043c6746d245d0bfe58a4767acaccc91e88
8785b0ff7f57ef2d33c2d4719a7185b8abd3f366

View File

@@ -37,6 +37,7 @@ abstract class AnimationBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is AnimationBase) {
_name = source._name;
}

View File

@@ -38,6 +38,7 @@ abstract class BlendAnimationBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is BlendAnimationBase) {
_animationId = source._animationId;
}

View File

@@ -37,6 +37,7 @@ abstract class KeyedObjectBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is KeyedObjectBase) {
_objectId = source._objectId;
}

View File

@@ -38,6 +38,7 @@ abstract class KeyedPropertyBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is KeyedPropertyBase) {
_propertyKey = source._propertyKey;
}

View File

@@ -37,6 +37,7 @@ abstract class KeyFrameBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is KeyFrameBase) {
_frame = source._frame;
}

View File

@@ -39,6 +39,7 @@ abstract class StateMachineComponentBase<T extends CoreContext>
@override
void copy(Core source) {
super.copy(source);
if (source is StateMachineComponentBase) {
_name = source._name;
}

View File

@@ -63,6 +63,7 @@ abstract class StateMachineFireEventBase<T extends CoreContext>
@override
void copy(Core source) {
super.copy(source);
if (source is StateMachineFireEventBase) {
_eventId = source._eventId;
_occursValue = source._occursValue;

View File

@@ -37,6 +37,7 @@ abstract class TransitionConditionBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is TransitionConditionBase) {
_inputId = source._inputId;
}

View File

@@ -36,6 +36,7 @@ abstract class AssetBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is AssetBase) {
_name = source._name;
}

View File

@@ -37,6 +37,7 @@ abstract class FileAssetContentsBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is FileAssetContentsBase) {
_bytes = source._bytes;
}

View File

@@ -61,6 +61,7 @@ abstract class ComponentBase<T extends CoreContext> extends Core<T> {
@override
void copy(Core source) {
super.copy(source);
if (source is ComponentBase) {
_name = source._name;
_parentId = source._parentId;

View File

@@ -7,7 +7,6 @@ export 'package:rive/src/generated/animation/animation_base.dart';
class Animation extends AnimationBase<RuntimeArtboard> {
Artboard? _artboard;
@override
Artboard? get artboard => _artboard;
set artboard(Artboard? value) {
if (_artboard == value) {

View File

@@ -195,7 +195,6 @@ class StateTransition extends StateTransitionBase {
exitTime += (lastTime / animationFrom.durationSeconds).floor() *
animationFrom.durationSeconds;
}
// Sometimes the time never reaches exitTime due to precision
// differences on diff platforms
if (time < exitTime) {
@@ -203,7 +202,6 @@ class StateTransition extends StateTransitionBase {
}
}
}
return AllowTransition.yes;
}

View File

@@ -1,6 +0,0 @@
import 'package:rive/src/rive_core/artboard.dart';
abstract class ArtboardProvider<T extends RiveCoreContext>
extends ArtboardProviderBase<T> {
Artboard? get artboard;
}

View File

@@ -1,18 +1,27 @@
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:rive/src/generated/assets/audio_asset_base.dart';
import 'package:rive_common/rive_audio.dart';
export 'package:rive/src/generated/assets/audio_asset_base.dart';
enum AudioContainerFormat { unknown, wav, flac, mp3 }
class AudioAsset extends AudioAssetBase {
// TODO: we probably want a specific audio object in the future..
Uint8List? _audioBytes;
final ValueNotifier<StreamingAudioSource?> audioSource = ValueNotifier(null);
Uint8List? get audioBytes => _audioBytes;
set audioBytes(Uint8List? bytes) {
if (_audioBytes == bytes) {
return;
}
_audioBytes = bytes;
audioSource.value?.dispose();
if (bytes != null) {
audioSource.value = AudioEngine.loadSource(bytes);
} else {
audioSource.value = null;
}
}
@override
@@ -21,14 +30,10 @@ class AudioAsset extends AudioAssetBase {
}
@override
String get fileExtension => 'wav';
String get fileExtension {
return 'wav';
}
@override
void onAssetError() {}
@override
bool get isAnalyzed => true;
@override
bool get canDraw => isAnalyzed && audioBytes != null;
}

View File

@@ -1,9 +1,11 @@
import 'package:rive/src/generated/audio_event_base.dart';
import 'package:rive/src/rive_core/artboard.dart';
import 'package:rive/src/rive_core/assets/audio_asset.dart';
import 'package:rive/src/rive_core/assets/file_asset.dart';
export 'package:rive/src/generated/audio_event_base.dart';
class AudioEvent extends AudioEventBase {
class AudioEvent extends AudioEventBase with FileAssetReferencer<AudioAsset> {
@override
void changeArtboard(Artboard? value) {
artboard?.internalRemoveEvent(this);
@@ -12,5 +14,16 @@ class AudioEvent extends AudioEventBase {
}
@override
void assetIdChanged(int from, int to) {}
void assetIdChanged(int from, int to) {
asset = context.resolve(to);
}
@override
void copy(covariant AudioEvent source) {
super.copy(source);
asset = source.asset;
}
@override
int get assetIdPropertyKey => AudioEventBase.assetIdPropertyKey;
}

View File

@@ -68,7 +68,6 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
/// The artboard this component belongs to.
@override
Artboard? get artboard => _artboard;
// Note that this isn't a setter as we don't want anything externally changing
@@ -143,8 +142,11 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
from?.children.remove(this);
from?.childRemoved(this);
to?.children.add(this);
to?.childAdded(this);
if (to != null) {
to.children.add(this);
to.childAdded(this);
}
// We need to resolve our artboard.
markRebuildDependencies();

View File

@@ -80,12 +80,9 @@ class Stroke extends StrokeBase {
void invalidateEffects() => _effect?.invalidateEffect();
@override
bool get isVisible => thickness > 0 && super.isVisible;
@override
void draw(Canvas canvas, Path path) {
if (!isVisible || renderOpacity == 0) {
if (!isVisible || renderOpacity == 0 || thickness <= 0) {
return;
}

View File

@@ -435,9 +435,8 @@ class Text extends TextBase with TextStyleContainer implements Sizable {
for (final line in paragraphLines) {
switch (overflow) {
case TextOverflow.hidden:
if (_layoutHeight == null ||
effectiveSizing == TextSizing.fixed &&
y + line.bottom > effectiveHeight) {
if (effectiveSizing == TextSizing.fixed &&
y + line.bottom > effectiveHeight) {
break outer;
}
break;

View File

@@ -46,6 +46,7 @@ class TextValueRun extends TextValueRunBase {
@override
void styleIdChanged(int from, int to) {
style = context.resolve(to);
markShapeDirty();
}
@override