Getting audio working in Flutter runtime.

@philter this also adds a bunch of layout stuff to the Flutter runtime as I had to run the core generator, does it all look ok?

Diffs=
6837ee0f7 Getting audio working in Flutter runtime. (#6975)
522a31bc2 treat cubic curve as quad when control point equals endpoint (#6919)
473dbcb5c Export proxy and testing at runtime. (#6950)
a69bfba11 Export audio clip (#6949)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This commit is contained in:
luigi-rosso
2024-04-03 22:26:25 +00:00
parent 584d00fa00
commit 3da1cbe3a1
14 changed files with 1977 additions and 1216 deletions

View File

@ -1 +1 @@
fee67f16df7648b5c9bc100b6221c7ba5baca0af
6837ee0f71109d0eee0f35ceb2326cf50325432b

View File

@ -0,0 +1,789 @@
// Core automatically generated
// lib/src/generated/layout/layout_component_style_base.dart.
// Do not modify manually.
import 'package:rive/src/core/core.dart';
import 'package:rive/src/rive_core/component.dart';
abstract class LayoutComponentStyleBase extends Component {
static const int typeKey = 420;
@override
int get coreType => LayoutComponentStyleBase.typeKey;
@override
Set<int> get coreTypes =>
{LayoutComponentStyleBase.typeKey, ComponentBase.typeKey};
/// --------------------------------------------------------------------------
/// LayoutFlags0 field with key 495.
static const int layoutFlags0PropertyKey = 495;
static const int layoutFlags0InitialValue = 0x5000412;
int _layoutFlags0 = layoutFlags0InitialValue;
/// First BitFlags for layout styles.
int get layoutFlags0 => _layoutFlags0;
/// Change the [_layoutFlags0] field value.
/// [layoutFlags0Changed] will be invoked only if the field's value has
/// changed.
set layoutFlags0(int value) {
if (_layoutFlags0 == value) {
return;
}
int from = _layoutFlags0;
_layoutFlags0 = value;
if (hasValidated) {
layoutFlags0Changed(from, value);
}
}
void layoutFlags0Changed(int from, int to);
/// --------------------------------------------------------------------------
/// LayoutFlags1 field with key 496.
static const int layoutFlags1PropertyKey = 496;
static const int layoutFlags1InitialValue = 0x00;
int _layoutFlags1 = layoutFlags1InitialValue;
/// Second BitFlags for layout styles.
int get layoutFlags1 => _layoutFlags1;
/// Change the [_layoutFlags1] field value.
/// [layoutFlags1Changed] will be invoked only if the field's value has
/// changed.
set layoutFlags1(int value) {
if (_layoutFlags1 == value) {
return;
}
int from = _layoutFlags1;
_layoutFlags1 = value;
if (hasValidated) {
layoutFlags1Changed(from, value);
}
}
void layoutFlags1Changed(int from, int to);
/// --------------------------------------------------------------------------
/// LayoutFlags2 field with key 497.
static const int layoutFlags2PropertyKey = 497;
static const int layoutFlags2InitialValue = 0x00;
int _layoutFlags2 = layoutFlags2InitialValue;
/// Third BitFlags for layout styles.
int get layoutFlags2 => _layoutFlags2;
/// Change the [_layoutFlags2] field value.
/// [layoutFlags2Changed] will be invoked only if the field's value has
/// changed.
set layoutFlags2(int value) {
if (_layoutFlags2 == value) {
return;
}
int from = _layoutFlags2;
_layoutFlags2 = value;
if (hasValidated) {
layoutFlags2Changed(from, value);
}
}
void layoutFlags2Changed(int from, int to);
/// --------------------------------------------------------------------------
/// GapHorizontal field with key 498.
static const int gapHorizontalPropertyKey = 498;
static const double gapHorizontalInitialValue = 0;
double _gapHorizontal = gapHorizontalInitialValue;
/// Horizontal gap between children in layout component
double get gapHorizontal => _gapHorizontal;
/// Change the [_gapHorizontal] field value.
/// [gapHorizontalChanged] will be invoked only if the field's value has
/// changed.
set gapHorizontal(double value) {
if (_gapHorizontal == value) {
return;
}
double from = _gapHorizontal;
_gapHorizontal = value;
if (hasValidated) {
gapHorizontalChanged(from, value);
}
}
void gapHorizontalChanged(double from, double to);
/// --------------------------------------------------------------------------
/// GapVertical field with key 499.
static const int gapVerticalPropertyKey = 499;
static const double gapVerticalInitialValue = 0;
double _gapVertical = gapVerticalInitialValue;
/// Vertical gap between children in layout component
double get gapVertical => _gapVertical;
/// Change the [_gapVertical] field value.
/// [gapVerticalChanged] will be invoked only if the field's value has
/// changed.
set gapVertical(double value) {
if (_gapVertical == value) {
return;
}
double from = _gapVertical;
_gapVertical = value;
if (hasValidated) {
gapVerticalChanged(from, value);
}
}
void gapVerticalChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MaxWidth field with key 500.
static const int maxWidthPropertyKey = 500;
static const double maxWidthInitialValue = 0;
double _maxWidth = maxWidthInitialValue;
/// Max width of the item.
double get maxWidth => _maxWidth;
/// Change the [_maxWidth] field value.
/// [maxWidthChanged] will be invoked only if the field's value has changed.
set maxWidth(double value) {
if (_maxWidth == value) {
return;
}
double from = _maxWidth;
_maxWidth = value;
if (hasValidated) {
maxWidthChanged(from, value);
}
}
void maxWidthChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MaxHeight field with key 501.
static const int maxHeightPropertyKey = 501;
static const double maxHeightInitialValue = 0;
double _maxHeight = maxHeightInitialValue;
/// Max height of the item.
double get maxHeight => _maxHeight;
/// Change the [_maxHeight] field value.
/// [maxHeightChanged] will be invoked only if the field's value has changed.
set maxHeight(double value) {
if (_maxHeight == value) {
return;
}
double from = _maxHeight;
_maxHeight = value;
if (hasValidated) {
maxHeightChanged(from, value);
}
}
void maxHeightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MinWidth field with key 502.
static const int minWidthPropertyKey = 502;
static const double minWidthInitialValue = 0;
double _minWidth = minWidthInitialValue;
/// Min width of the item.
double get minWidth => _minWidth;
/// Change the [_minWidth] field value.
/// [minWidthChanged] will be invoked only if the field's value has changed.
set minWidth(double value) {
if (_minWidth == value) {
return;
}
double from = _minWidth;
_minWidth = value;
if (hasValidated) {
minWidthChanged(from, value);
}
}
void minWidthChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MinHeight field with key 503.
static const int minHeightPropertyKey = 503;
static const double minHeightInitialValue = 0;
double _minHeight = minHeightInitialValue;
/// Min height of the item.
double get minHeight => _minHeight;
/// Change the [_minHeight] field value.
/// [minHeightChanged] will be invoked only if the field's value has changed.
set minHeight(double value) {
if (_minHeight == value) {
return;
}
double from = _minHeight;
_minHeight = value;
if (hasValidated) {
minHeightChanged(from, value);
}
}
void minHeightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// BorderLeft field with key 504.
static const int borderLeftPropertyKey = 504;
static const double borderLeftInitialValue = 0;
double _borderLeft = borderLeftInitialValue;
/// Left border value.
double get borderLeft => _borderLeft;
/// Change the [_borderLeft] field value.
/// [borderLeftChanged] will be invoked only if the field's value has changed.
set borderLeft(double value) {
if (_borderLeft == value) {
return;
}
double from = _borderLeft;
_borderLeft = value;
if (hasValidated) {
borderLeftChanged(from, value);
}
}
void borderLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// BorderRight field with key 505.
static const int borderRightPropertyKey = 505;
static const double borderRightInitialValue = 0;
double _borderRight = borderRightInitialValue;
/// Right border value.
double get borderRight => _borderRight;
/// Change the [_borderRight] field value.
/// [borderRightChanged] will be invoked only if the field's value has
/// changed.
set borderRight(double value) {
if (_borderRight == value) {
return;
}
double from = _borderRight;
_borderRight = value;
if (hasValidated) {
borderRightChanged(from, value);
}
}
void borderRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// BorderTop field with key 506.
static const int borderTopPropertyKey = 506;
static const double borderTopInitialValue = 0;
double _borderTop = borderTopInitialValue;
/// Top border value.
double get borderTop => _borderTop;
/// Change the [_borderTop] field value.
/// [borderTopChanged] will be invoked only if the field's value has changed.
set borderTop(double value) {
if (_borderTop == value) {
return;
}
double from = _borderTop;
_borderTop = value;
if (hasValidated) {
borderTopChanged(from, value);
}
}
void borderTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// BorderBottom field with key 507.
static const int borderBottomPropertyKey = 507;
static const double borderBottomInitialValue = 0;
double _borderBottom = borderBottomInitialValue;
/// Bottom border value.
double get borderBottom => _borderBottom;
/// Change the [_borderBottom] field value.
/// [borderBottomChanged] will be invoked only if the field's value has
/// changed.
set borderBottom(double value) {
if (_borderBottom == value) {
return;
}
double from = _borderBottom;
_borderBottom = value;
if (hasValidated) {
borderBottomChanged(from, value);
}
}
void borderBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginLeft field with key 508.
static const int marginLeftPropertyKey = 508;
static const double marginLeftInitialValue = 0;
double _marginLeft = marginLeftInitialValue;
/// Left margin value.
double get marginLeft => _marginLeft;
/// Change the [_marginLeft] field value.
/// [marginLeftChanged] will be invoked only if the field's value has changed.
set marginLeft(double value) {
if (_marginLeft == value) {
return;
}
double from = _marginLeft;
_marginLeft = value;
if (hasValidated) {
marginLeftChanged(from, value);
}
}
void marginLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginRight field with key 509.
static const int marginRightPropertyKey = 509;
static const double marginRightInitialValue = 0;
double _marginRight = marginRightInitialValue;
/// Right margin value.
double get marginRight => _marginRight;
/// Change the [_marginRight] field value.
/// [marginRightChanged] will be invoked only if the field's value has
/// changed.
set marginRight(double value) {
if (_marginRight == value) {
return;
}
double from = _marginRight;
_marginRight = value;
if (hasValidated) {
marginRightChanged(from, value);
}
}
void marginRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginTop field with key 510.
static const int marginTopPropertyKey = 510;
static const double marginTopInitialValue = 0;
double _marginTop = marginTopInitialValue;
/// Top margin value.
double get marginTop => _marginTop;
/// Change the [_marginTop] field value.
/// [marginTopChanged] will be invoked only if the field's value has changed.
set marginTop(double value) {
if (_marginTop == value) {
return;
}
double from = _marginTop;
_marginTop = value;
if (hasValidated) {
marginTopChanged(from, value);
}
}
void marginTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginBottom field with key 511.
static const int marginBottomPropertyKey = 511;
static const double marginBottomInitialValue = 0;
double _marginBottom = marginBottomInitialValue;
/// Bottom margin value.
double get marginBottom => _marginBottom;
/// Change the [_marginBottom] field value.
/// [marginBottomChanged] will be invoked only if the field's value has
/// changed.
set marginBottom(double value) {
if (_marginBottom == value) {
return;
}
double from = _marginBottom;
_marginBottom = value;
if (hasValidated) {
marginBottomChanged(from, value);
}
}
void marginBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingLeft field with key 512.
static const int paddingLeftPropertyKey = 512;
static const double paddingLeftInitialValue = 0;
double _paddingLeft = paddingLeftInitialValue;
/// Left padding value.
double get paddingLeft => _paddingLeft;
/// Change the [_paddingLeft] field value.
/// [paddingLeftChanged] will be invoked only if the field's value has
/// changed.
set paddingLeft(double value) {
if (_paddingLeft == value) {
return;
}
double from = _paddingLeft;
_paddingLeft = value;
if (hasValidated) {
paddingLeftChanged(from, value);
}
}
void paddingLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingRight field with key 513.
static const int paddingRightPropertyKey = 513;
static const double paddingRightInitialValue = 0;
double _paddingRight = paddingRightInitialValue;
/// Right padding value.
double get paddingRight => _paddingRight;
/// Change the [_paddingRight] field value.
/// [paddingRightChanged] will be invoked only if the field's value has
/// changed.
set paddingRight(double value) {
if (_paddingRight == value) {
return;
}
double from = _paddingRight;
_paddingRight = value;
if (hasValidated) {
paddingRightChanged(from, value);
}
}
void paddingRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingTop field with key 514.
static const int paddingTopPropertyKey = 514;
static const double paddingTopInitialValue = 0;
double _paddingTop = paddingTopInitialValue;
/// Top padding value.
double get paddingTop => _paddingTop;
/// Change the [_paddingTop] field value.
/// [paddingTopChanged] will be invoked only if the field's value has changed.
set paddingTop(double value) {
if (_paddingTop == value) {
return;
}
double from = _paddingTop;
_paddingTop = value;
if (hasValidated) {
paddingTopChanged(from, value);
}
}
void paddingTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingBottom field with key 515.
static const int paddingBottomPropertyKey = 515;
static const double paddingBottomInitialValue = 0;
double _paddingBottom = paddingBottomInitialValue;
/// Bottom padding value.
double get paddingBottom => _paddingBottom;
/// Change the [_paddingBottom] field value.
/// [paddingBottomChanged] will be invoked only if the field's value has
/// changed.
set paddingBottom(double value) {
if (_paddingBottom == value) {
return;
}
double from = _paddingBottom;
_paddingBottom = value;
if (hasValidated) {
paddingBottomChanged(from, value);
}
}
void paddingBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PositionLeft field with key 516.
static const int positionLeftPropertyKey = 516;
static const double positionLeftInitialValue = 0;
double _positionLeft = positionLeftInitialValue;
/// Left position value.
double get positionLeft => _positionLeft;
/// Change the [_positionLeft] field value.
/// [positionLeftChanged] will be invoked only if the field's value has
/// changed.
set positionLeft(double value) {
if (_positionLeft == value) {
return;
}
double from = _positionLeft;
_positionLeft = value;
if (hasValidated) {
positionLeftChanged(from, value);
}
}
void positionLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PositionRight field with key 517.
static const int positionRightPropertyKey = 517;
static const double positionRightInitialValue = 0;
double _positionRight = positionRightInitialValue;
/// Right position value.
double get positionRight => _positionRight;
/// Change the [_positionRight] field value.
/// [positionRightChanged] will be invoked only if the field's value has
/// changed.
set positionRight(double value) {
if (_positionRight == value) {
return;
}
double from = _positionRight;
_positionRight = value;
if (hasValidated) {
positionRightChanged(from, value);
}
}
void positionRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PositionTop field with key 518.
static const int positionTopPropertyKey = 518;
static const double positionTopInitialValue = 0;
double _positionTop = positionTopInitialValue;
/// Top position value.
double get positionTop => _positionTop;
/// Change the [_positionTop] field value.
/// [positionTopChanged] will be invoked only if the field's value has
/// changed.
set positionTop(double value) {
if (_positionTop == value) {
return;
}
double from = _positionTop;
_positionTop = value;
if (hasValidated) {
positionTopChanged(from, value);
}
}
void positionTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PositionBottom field with key 519.
static const int positionBottomPropertyKey = 519;
static const double positionBottomInitialValue = 0;
double _positionBottom = positionBottomInitialValue;
/// Bottom position value.
double get positionBottom => _positionBottom;
/// Change the [_positionBottom] field value.
/// [positionBottomChanged] will be invoked only if the field's value has
/// changed.
set positionBottom(double value) {
if (_positionBottom == value) {
return;
}
double from = _positionBottom;
_positionBottom = value;
if (hasValidated) {
positionBottomChanged(from, value);
}
}
void positionBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// Flex field with key 520.
static const int flexPropertyKey = 520;
static const double flexInitialValue = 0;
double _flex = flexInitialValue;
/// Flex value.
double get flex => _flex;
/// Change the [_flex] field value.
/// [flexChanged] will be invoked only if the field's value has changed.
set flex(double value) {
if (_flex == value) {
return;
}
double from = _flex;
_flex = value;
if (hasValidated) {
flexChanged(from, value);
}
}
void flexChanged(double from, double to);
/// --------------------------------------------------------------------------
/// FlexGrow field with key 521.
static const int flexGrowPropertyKey = 521;
static const double flexGrowInitialValue = 0;
double _flexGrow = flexGrowInitialValue;
/// Flex grow value.
double get flexGrow => _flexGrow;
/// Change the [_flexGrow] field value.
/// [flexGrowChanged] will be invoked only if the field's value has changed.
set flexGrow(double value) {
if (_flexGrow == value) {
return;
}
double from = _flexGrow;
_flexGrow = value;
if (hasValidated) {
flexGrowChanged(from, value);
}
}
void flexGrowChanged(double from, double to);
/// --------------------------------------------------------------------------
/// FlexShrink field with key 522.
static const int flexShrinkPropertyKey = 522;
static const double flexShrinkInitialValue = 1;
double _flexShrink = flexShrinkInitialValue;
/// Flex shrink value.
double get flexShrink => _flexShrink;
/// Change the [_flexShrink] field value.
/// [flexShrinkChanged] will be invoked only if the field's value has changed.
set flexShrink(double value) {
if (_flexShrink == value) {
return;
}
double from = _flexShrink;
_flexShrink = value;
if (hasValidated) {
flexShrinkChanged(from, value);
}
}
void flexShrinkChanged(double from, double to);
/// --------------------------------------------------------------------------
/// FlexBasis field with key 523.
static const int flexBasisPropertyKey = 523;
static const double flexBasisInitialValue = 1;
double _flexBasis = flexBasisInitialValue;
/// Flex basis value.
double get flexBasis => _flexBasis;
/// Change the [_flexBasis] field value.
/// [flexBasisChanged] will be invoked only if the field's value has changed.
set flexBasis(double value) {
if (_flexBasis == value) {
return;
}
double from = _flexBasis;
_flexBasis = value;
if (hasValidated) {
flexBasisChanged(from, value);
}
}
void flexBasisChanged(double from, double to);
/// --------------------------------------------------------------------------
/// AspectRatio field with key 524.
static const int aspectRatioPropertyKey = 524;
static const double aspectRatioInitialValue = 0;
double _aspectRatio = aspectRatioInitialValue;
/// Aspect ratio value.
double get aspectRatio => _aspectRatio;
/// Change the [_aspectRatio] field value.
/// [aspectRatioChanged] will be invoked only if the field's value has
/// changed.
set aspectRatio(double value) {
if (_aspectRatio == value) {
return;
}
double from = _aspectRatio;
_aspectRatio = value;
if (hasValidated) {
aspectRatioChanged(from, value);
}
}
void aspectRatioChanged(double from, double to);
@override
void copy(Core source) {
super.copy(source);
if (source is LayoutComponentStyleBase) {
_layoutFlags0 = source._layoutFlags0;
_layoutFlags1 = source._layoutFlags1;
_layoutFlags2 = source._layoutFlags2;
_gapHorizontal = source._gapHorizontal;
_gapVertical = source._gapVertical;
_maxWidth = source._maxWidth;
_maxHeight = source._maxHeight;
_minWidth = source._minWidth;
_minHeight = source._minHeight;
_borderLeft = source._borderLeft;
_borderRight = source._borderRight;
_borderTop = source._borderTop;
_borderBottom = source._borderBottom;
_marginLeft = source._marginLeft;
_marginRight = source._marginRight;
_marginTop = source._marginTop;
_marginBottom = source._marginBottom;
_paddingLeft = source._paddingLeft;
_paddingRight = source._paddingRight;
_paddingTop = source._paddingTop;
_paddingBottom = source._paddingBottom;
_positionLeft = source._positionLeft;
_positionRight = source._positionRight;
_positionTop = source._positionTop;
_positionBottom = source._positionBottom;
_flex = source._flex;
_flexGrow = source._flexGrow;
_flexShrink = source._flexShrink;
_flexBasis = source._flexBasis;
_aspectRatio = source._aspectRatio;
}
}
}

View File

@ -42,129 +42,6 @@ abstract class LayoutComponentBase extends WorldTransformComponent {
void clipChanged(bool from, bool to);
/// --------------------------------------------------------------------------
/// LayoutFlags0 field with key 414.
static const int layoutFlags0PropertyKey = 414;
static const int layoutFlags0InitialValue = 0x55000;
int _layoutFlags0 = layoutFlags0InitialValue;
/// First BitFlags for layout styles.
int get layoutFlags0 => _layoutFlags0;
/// Change the [_layoutFlags0] field value.
/// [layoutFlags0Changed] will be invoked only if the field's value has
/// changed.
set layoutFlags0(int value) {
if (_layoutFlags0 == value) {
return;
}
int from = _layoutFlags0;
_layoutFlags0 = value;
if (hasValidated) {
layoutFlags0Changed(from, value);
}
}
void layoutFlags0Changed(int from, int to);
/// --------------------------------------------------------------------------
/// LayoutFlags1 field with key 415.
static const int layoutFlags1PropertyKey = 415;
static const int layoutFlags1InitialValue = 0x00;
int _layoutFlags1 = layoutFlags1InitialValue;
/// Second BitFlags for layout styles.
int get layoutFlags1 => _layoutFlags1;
/// Change the [_layoutFlags1] field value.
/// [layoutFlags1Changed] will be invoked only if the field's value has
/// changed.
set layoutFlags1(int value) {
if (_layoutFlags1 == value) {
return;
}
int from = _layoutFlags1;
_layoutFlags1 = value;
if (hasValidated) {
layoutFlags1Changed(from, value);
}
}
void layoutFlags1Changed(int from, int to);
/// --------------------------------------------------------------------------
/// LayoutFlags2 field with key 441.
static const int layoutFlags2PropertyKey = 441;
static const int layoutFlags2InitialValue = 0x00;
int _layoutFlags2 = layoutFlags2InitialValue;
/// Third BitFlags for layout styles.
int get layoutFlags2 => _layoutFlags2;
/// Change the [_layoutFlags2] field value.
/// [layoutFlags2Changed] will be invoked only if the field's value has
/// changed.
set layoutFlags2(int value) {
if (_layoutFlags2 == value) {
return;
}
int from = _layoutFlags2;
_layoutFlags2 = value;
if (hasValidated) {
layoutFlags2Changed(from, value);
}
}
void layoutFlags2Changed(int from, int to);
/// --------------------------------------------------------------------------
/// GapWidth field with key 416.
static const int gapWidthPropertyKey = 416;
static const double gapWidthInitialValue = 0;
double _gapWidth = gapWidthInitialValue;
/// How large should the gaps between items in a grid or flex container be?
double get gapWidth => _gapWidth;
/// Change the [_gapWidth] field value.
/// [gapWidthChanged] will be invoked only if the field's value has changed.
set gapWidth(double value) {
if (_gapWidth == value) {
return;
}
double from = _gapWidth;
_gapWidth = value;
if (hasValidated) {
gapWidthChanged(from, value);
}
}
void gapWidthChanged(double from, double to);
/// --------------------------------------------------------------------------
/// GapHeight field with key 417.
static const int gapHeightPropertyKey = 417;
static const double gapHeightInitialValue = 0;
double _gapHeight = gapHeightInitialValue;
/// How large should the gaps between items in a grid or flex container be?
double get gapHeight => _gapHeight;
/// Change the [_gapHeight] field value.
/// [gapHeightChanged] will be invoked only if the field's value has changed.
set gapHeight(double value) {
if (_gapHeight == value) {
return;
}
double from = _gapHeight;
_gapHeight = value;
if (hasValidated) {
gapHeightChanged(from, value);
}
}
void gapHeightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// Width field with key 7.
static const int widthPropertyKey = 7;
@ -214,602 +91,37 @@ abstract class LayoutComponentBase extends WorldTransformComponent {
void heightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MaxWidth field with key 418.
static const int maxWidthPropertyKey = 418;
static const double maxWidthInitialValue = 0;
double _maxWidth = maxWidthInitialValue;
/// StyleId field with key 494.
static const int styleIdPropertyKey = 494;
static const int styleIdInitialValue = -1;
int _styleId = styleIdInitialValue;
/// Max width of the item.
double get maxWidth => _maxWidth;
/// LayoutStyle that defines the styling for this LayoutComponent
int get styleId => _styleId;
/// Change the [_maxWidth] field value.
/// [maxWidthChanged] will be invoked only if the field's value has changed.
set maxWidth(double value) {
if (_maxWidth == value) {
/// Change the [_styleId] field value.
/// [styleIdChanged] will be invoked only if the field's value has changed.
set styleId(int value) {
if (_styleId == value) {
return;
}
double from = _maxWidth;
_maxWidth = value;
int from = _styleId;
_styleId = value;
if (hasValidated) {
maxWidthChanged(from, value);
styleIdChanged(from, value);
}
}
void maxWidthChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MaxHeight field with key 419.
static const int maxHeightPropertyKey = 419;
static const double maxHeightInitialValue = 0;
double _maxHeight = maxHeightInitialValue;
/// Max height of the item.
double get maxHeight => _maxHeight;
/// Change the [_maxHeight] field value.
/// [maxHeightChanged] will be invoked only if the field's value has changed.
set maxHeight(double value) {
if (_maxHeight == value) {
return;
}
double from = _maxHeight;
_maxHeight = value;
if (hasValidated) {
maxHeightChanged(from, value);
}
}
void maxHeightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MinWidth field with key 447.
static const int minWidthPropertyKey = 447;
static const double minWidthInitialValue = 0;
double _minWidth = minWidthInitialValue;
/// Min width of the item.
double get minWidth => _minWidth;
/// Change the [_minWidth] field value.
/// [minWidthChanged] will be invoked only if the field's value has changed.
set minWidth(double value) {
if (_minWidth == value) {
return;
}
double from = _minWidth;
_minWidth = value;
if (hasValidated) {
minWidthChanged(from, value);
}
}
void minWidthChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MinHeight field with key 448.
static const int minHeightPropertyKey = 448;
static const double minHeightInitialValue = 0;
double _minHeight = minHeightInitialValue;
/// Min height of the item.
double get minHeight => _minHeight;
/// Change the [_minHeight] field value.
/// [minHeightChanged] will be invoked only if the field's value has changed.
set minHeight(double value) {
if (_minHeight == value) {
return;
}
double from = _minHeight;
_minHeight = value;
if (hasValidated) {
minHeightChanged(from, value);
}
}
void minHeightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginLeft field with key 454.
static const int marginLeftPropertyKey = 454;
static const double marginLeftInitialValue = 0;
double _marginLeft = marginLeftInitialValue;
/// Left margin value.
double get marginLeft => _marginLeft;
/// Change the [_marginLeft] field value.
/// [marginLeftChanged] will be invoked only if the field's value has changed.
set marginLeft(double value) {
if (_marginLeft == value) {
return;
}
double from = _marginLeft;
_marginLeft = value;
if (hasValidated) {
marginLeftChanged(from, value);
}
}
void marginLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginRight field with key 455.
static const int marginRightPropertyKey = 455;
static const double marginRightInitialValue = 0;
double _marginRight = marginRightInitialValue;
/// Right margin value.
double get marginRight => _marginRight;
/// Change the [_marginRight] field value.
/// [marginRightChanged] will be invoked only if the field's value has
/// changed.
set marginRight(double value) {
if (_marginRight == value) {
return;
}
double from = _marginRight;
_marginRight = value;
if (hasValidated) {
marginRightChanged(from, value);
}
}
void marginRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginTop field with key 449.
static const int marginTopPropertyKey = 449;
static const double marginTopInitialValue = 0;
double _marginTop = marginTopInitialValue;
/// Top margin value.
double get marginTop => _marginTop;
/// Change the [_marginTop] field value.
/// [marginTopChanged] will be invoked only if the field's value has changed.
set marginTop(double value) {
if (_marginTop == value) {
return;
}
double from = _marginTop;
_marginTop = value;
if (hasValidated) {
marginTopChanged(from, value);
}
}
void marginTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// MarginBottom field with key 456.
static const int marginBottomPropertyKey = 456;
static const double marginBottomInitialValue = 0;
double _marginBottom = marginBottomInitialValue;
/// Bottom margin value.
double get marginBottom => _marginBottom;
/// Change the [_marginBottom] field value.
/// [marginBottomChanged] will be invoked only if the field's value has
/// changed.
set marginBottom(double value) {
if (_marginBottom == value) {
return;
}
double from = _marginBottom;
_marginBottom = value;
if (hasValidated) {
marginBottomChanged(from, value);
}
}
void marginBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingLeft field with key 442.
static const int paddingLeftPropertyKey = 442;
static const double paddingLeftInitialValue = 0;
double _paddingLeft = paddingLeftInitialValue;
/// Left padding value.
double get paddingLeft => _paddingLeft;
/// Change the [_paddingLeft] field value.
/// [paddingLeftChanged] will be invoked only if the field's value has
/// changed.
set paddingLeft(double value) {
if (_paddingLeft == value) {
return;
}
double from = _paddingLeft;
_paddingLeft = value;
if (hasValidated) {
paddingLeftChanged(from, value);
}
}
void paddingLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingRight field with key 443.
static const int paddingRightPropertyKey = 443;
static const double paddingRightInitialValue = 0;
double _paddingRight = paddingRightInitialValue;
/// Right padding value.
double get paddingRight => _paddingRight;
/// Change the [_paddingRight] field value.
/// [paddingRightChanged] will be invoked only if the field's value has
/// changed.
set paddingRight(double value) {
if (_paddingRight == value) {
return;
}
double from = _paddingRight;
_paddingRight = value;
if (hasValidated) {
paddingRightChanged(from, value);
}
}
void paddingRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingTop field with key 444.
static const int paddingTopPropertyKey = 444;
static const double paddingTopInitialValue = 0;
double _paddingTop = paddingTopInitialValue;
/// Top padding value.
double get paddingTop => _paddingTop;
/// Change the [_paddingTop] field value.
/// [paddingTopChanged] will be invoked only if the field's value has changed.
set paddingTop(double value) {
if (_paddingTop == value) {
return;
}
double from = _paddingTop;
_paddingTop = value;
if (hasValidated) {
paddingTopChanged(from, value);
}
}
void paddingTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// PaddingBottom field with key 445.
static const int paddingBottomPropertyKey = 445;
static const double paddingBottomInitialValue = 0;
double _paddingBottom = paddingBottomInitialValue;
/// Bottom padding value.
double get paddingBottom => _paddingBottom;
/// Change the [_paddingBottom] field value.
/// [paddingBottomChanged] will be invoked only if the field's value has
/// changed.
set paddingBottom(double value) {
if (_paddingBottom == value) {
return;
}
double from = _paddingBottom;
_paddingBottom = value;
if (hasValidated) {
paddingBottomChanged(from, value);
}
}
void paddingBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// InsetLeft field with key 450.
static const int insetLeftPropertyKey = 450;
static const double insetLeftInitialValue = 0;
double _insetLeft = insetLeftInitialValue;
/// Left inset value.
double get insetLeft => _insetLeft;
/// Change the [_insetLeft] field value.
/// [insetLeftChanged] will be invoked only if the field's value has changed.
set insetLeft(double value) {
if (_insetLeft == value) {
return;
}
double from = _insetLeft;
_insetLeft = value;
if (hasValidated) {
insetLeftChanged(from, value);
}
}
void insetLeftChanged(double from, double to);
/// --------------------------------------------------------------------------
/// InsetRight field with key 451.
static const int insetRightPropertyKey = 451;
static const double insetRightInitialValue = 0;
double _insetRight = insetRightInitialValue;
/// Right inset value.
double get insetRight => _insetRight;
/// Change the [_insetRight] field value.
/// [insetRightChanged] will be invoked only if the field's value has changed.
set insetRight(double value) {
if (_insetRight == value) {
return;
}
double from = _insetRight;
_insetRight = value;
if (hasValidated) {
insetRightChanged(from, value);
}
}
void insetRightChanged(double from, double to);
/// --------------------------------------------------------------------------
/// InsetTop field with key 452.
static const int insetTopPropertyKey = 452;
static const double insetTopInitialValue = 0;
double _insetTop = insetTopInitialValue;
/// Top inset value.
double get insetTop => _insetTop;
/// Change the [_insetTop] field value.
/// [insetTopChanged] will be invoked only if the field's value has changed.
set insetTop(double value) {
if (_insetTop == value) {
return;
}
double from = _insetTop;
_insetTop = value;
if (hasValidated) {
insetTopChanged(from, value);
}
}
void insetTopChanged(double from, double to);
/// --------------------------------------------------------------------------
/// InsetBottom field with key 453.
static const int insetBottomPropertyKey = 453;
static const double insetBottomInitialValue = 0;
double _insetBottom = insetBottomInitialValue;
/// Bottom inset value.
double get insetBottom => _insetBottom;
/// Change the [_insetBottom] field value.
/// [insetBottomChanged] will be invoked only if the field's value has
/// changed.
set insetBottom(double value) {
if (_insetBottom == value) {
return;
}
double from = _insetBottom;
_insetBottom = value;
if (hasValidated) {
insetBottomChanged(from, value);
}
}
void insetBottomChanged(double from, double to);
/// --------------------------------------------------------------------------
/// FlexGrow field with key 457.
static const int flexGrowPropertyKey = 457;
static const double flexGrowInitialValue = 0;
double _flexGrow = flexGrowInitialValue;
/// Flex grow value.
double get flexGrow => _flexGrow;
/// Change the [_flexGrow] field value.
/// [flexGrowChanged] will be invoked only if the field's value has changed.
set flexGrow(double value) {
if (_flexGrow == value) {
return;
}
double from = _flexGrow;
_flexGrow = value;
if (hasValidated) {
flexGrowChanged(from, value);
}
}
void flexGrowChanged(double from, double to);
/// --------------------------------------------------------------------------
/// FlexShrink field with key 458.
static const int flexShrinkPropertyKey = 458;
static const double flexShrinkInitialValue = 1;
double _flexShrink = flexShrinkInitialValue;
/// Flex shrink value.
double get flexShrink => _flexShrink;
/// Change the [_flexShrink] field value.
/// [flexShrinkChanged] will be invoked only if the field's value has changed.
set flexShrink(double value) {
if (_flexShrink == value) {
return;
}
double from = _flexShrink;
_flexShrink = value;
if (hasValidated) {
flexShrinkChanged(from, value);
}
}
void flexShrinkChanged(double from, double to);
/// --------------------------------------------------------------------------
/// AspectRatio field with key 446.
static const int aspectRatioPropertyKey = 446;
static const double aspectRatioInitialValue = 0;
double _aspectRatio = aspectRatioInitialValue;
/// Aspect ratio value.
double get aspectRatio => _aspectRatio;
/// Change the [_aspectRatio] field value.
/// [aspectRatioChanged] will be invoked only if the field's value has
/// changed.
set aspectRatio(double value) {
if (_aspectRatio == value) {
return;
}
double from = _aspectRatio;
_aspectRatio = value;
if (hasValidated) {
aspectRatioChanged(from, value);
}
}
void aspectRatioChanged(double from, double to);
/// --------------------------------------------------------------------------
/// GridRowStart field with key 469.
static const int gridRowStartPropertyKey = 469;
static const int gridRowStartInitialValue = 1;
int _gridRowStart = gridRowStartInitialValue;
/// Start position of grid item in a row.
int get gridRowStart => _gridRowStart;
/// Change the [_gridRowStart] field value.
/// [gridRowStartChanged] will be invoked only if the field's value has
/// changed.
set gridRowStart(int value) {
if (_gridRowStart == value) {
return;
}
int from = _gridRowStart;
_gridRowStart = value;
if (hasValidated) {
gridRowStartChanged(from, value);
}
}
void gridRowStartChanged(int from, int to);
/// --------------------------------------------------------------------------
/// GridRowEnd field with key 470.
static const int gridRowEndPropertyKey = 470;
static const int gridRowEndInitialValue = 1;
int _gridRowEnd = gridRowEndInitialValue;
/// End position of grid item in a row.
int get gridRowEnd => _gridRowEnd;
/// Change the [_gridRowEnd] field value.
/// [gridRowEndChanged] will be invoked only if the field's value has changed.
set gridRowEnd(int value) {
if (_gridRowEnd == value) {
return;
}
int from = _gridRowEnd;
_gridRowEnd = value;
if (hasValidated) {
gridRowEndChanged(from, value);
}
}
void gridRowEndChanged(int from, int to);
/// --------------------------------------------------------------------------
/// GridColumnStart field with key 471.
static const int gridColumnStartPropertyKey = 471;
static const int gridColumnStartInitialValue = 1;
int _gridColumnStart = gridColumnStartInitialValue;
/// Start position of grid item in a column.
int get gridColumnStart => _gridColumnStart;
/// Change the [_gridColumnStart] field value.
/// [gridColumnStartChanged] will be invoked only if the field's value has
/// changed.
set gridColumnStart(int value) {
if (_gridColumnStart == value) {
return;
}
int from = _gridColumnStart;
_gridColumnStart = value;
if (hasValidated) {
gridColumnStartChanged(from, value);
}
}
void gridColumnStartChanged(int from, int to);
/// --------------------------------------------------------------------------
/// GridColumnEnd field with key 472.
static const int gridColumnEndPropertyKey = 472;
static const int gridColumnEndInitialValue = 1;
int _gridColumnEnd = gridColumnEndInitialValue;
/// End position of grid item in a column.
int get gridColumnEnd => _gridColumnEnd;
/// Change the [_gridColumnEnd] field value.
/// [gridColumnEndChanged] will be invoked only if the field's value has
/// changed.
set gridColumnEnd(int value) {
if (_gridColumnEnd == value) {
return;
}
int from = _gridColumnEnd;
_gridColumnEnd = value;
if (hasValidated) {
gridColumnEndChanged(from, value);
}
}
void gridColumnEndChanged(int from, int to);
void styleIdChanged(int from, int to);
@override
void copy(Core source) {
super.copy(source);
if (source is LayoutComponentBase) {
_clip = source._clip;
_layoutFlags0 = source._layoutFlags0;
_layoutFlags1 = source._layoutFlags1;
_layoutFlags2 = source._layoutFlags2;
_gapWidth = source._gapWidth;
_gapHeight = source._gapHeight;
_width = source._width;
_height = source._height;
_maxWidth = source._maxWidth;
_maxHeight = source._maxHeight;
_minWidth = source._minWidth;
_minHeight = source._minHeight;
_marginLeft = source._marginLeft;
_marginRight = source._marginRight;
_marginTop = source._marginTop;
_marginBottom = source._marginBottom;
_paddingLeft = source._paddingLeft;
_paddingRight = source._paddingRight;
_paddingTop = source._paddingTop;
_paddingBottom = source._paddingBottom;
_insetLeft = source._insetLeft;
_insetRight = source._insetRight;
_insetTop = source._insetTop;
_insetBottom = source._insetBottom;
_flexGrow = source._flexGrow;
_flexShrink = source._flexShrink;
_aspectRatio = source._aspectRatio;
_gridRowStart = source._gridRowStart;
_gridRowEnd = source._gridRowEnd;
_gridColumnStart = source._gridColumnStart;
_gridColumnEnd = source._gridColumnEnd;
_styleId = source._styleId;
}
}
}

View File

@ -109,6 +109,7 @@ 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/joystick.dart';
import 'package:rive/src/rive_core/layout/layout_component_style.dart';
import 'package:rive/src/rive_core/layout_component.dart';
import 'package:rive/src/rive_core/nested_artboard.dart';
import 'package:rive/src/rive_core/node.dart';
@ -174,6 +175,8 @@ class RiveCoreContext {
return NestedArtboard();
case SoloBase.typeKey:
return Solo();
case LayoutComponentStyleBase.typeKey:
return LayoutComponentStyle();
case ListenerFireEventBase.typeKey:
return ListenerFireEvent();
case AnimationBase.typeKey:
@ -590,6 +593,156 @@ class RiveCoreContext {
object.activeComponentId = value;
}
break;
case LayoutComponentStyleBase.layoutFlags0PropertyKey:
if (object is LayoutComponentStyleBase && value is int) {
object.layoutFlags0 = value;
}
break;
case LayoutComponentStyleBase.layoutFlags1PropertyKey:
if (object is LayoutComponentStyleBase && value is int) {
object.layoutFlags1 = value;
}
break;
case LayoutComponentStyleBase.layoutFlags2PropertyKey:
if (object is LayoutComponentStyleBase && value is int) {
object.layoutFlags2 = value;
}
break;
case LayoutComponentStyleBase.gapHorizontalPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.gapHorizontal = value;
}
break;
case LayoutComponentStyleBase.gapVerticalPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.gapVertical = value;
}
break;
case LayoutComponentStyleBase.maxWidthPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.maxWidth = value;
}
break;
case LayoutComponentStyleBase.maxHeightPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.maxHeight = value;
}
break;
case LayoutComponentStyleBase.minWidthPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.minWidth = value;
}
break;
case LayoutComponentStyleBase.minHeightPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.minHeight = value;
}
break;
case LayoutComponentStyleBase.borderLeftPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.borderLeft = value;
}
break;
case LayoutComponentStyleBase.borderRightPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.borderRight = value;
}
break;
case LayoutComponentStyleBase.borderTopPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.borderTop = value;
}
break;
case LayoutComponentStyleBase.borderBottomPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.borderBottom = value;
}
break;
case LayoutComponentStyleBase.marginLeftPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.marginLeft = value;
}
break;
case LayoutComponentStyleBase.marginRightPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.marginRight = value;
}
break;
case LayoutComponentStyleBase.marginTopPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.marginTop = value;
}
break;
case LayoutComponentStyleBase.marginBottomPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.marginBottom = value;
}
break;
case LayoutComponentStyleBase.paddingLeftPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.paddingLeft = value;
}
break;
case LayoutComponentStyleBase.paddingRightPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.paddingRight = value;
}
break;
case LayoutComponentStyleBase.paddingTopPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.paddingTop = value;
}
break;
case LayoutComponentStyleBase.paddingBottomPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.paddingBottom = value;
}
break;
case LayoutComponentStyleBase.positionLeftPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.positionLeft = value;
}
break;
case LayoutComponentStyleBase.positionRightPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.positionRight = value;
}
break;
case LayoutComponentStyleBase.positionTopPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.positionTop = value;
}
break;
case LayoutComponentStyleBase.positionBottomPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.positionBottom = value;
}
break;
case LayoutComponentStyleBase.flexPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.flex = value;
}
break;
case LayoutComponentStyleBase.flexGrowPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.flexGrow = value;
}
break;
case LayoutComponentStyleBase.flexShrinkPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.flexShrink = value;
}
break;
case LayoutComponentStyleBase.flexBasisPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.flexBasis = value;
}
break;
case LayoutComponentStyleBase.aspectRatioPropertyKey:
if (object is LayoutComponentStyleBase && value is double) {
object.aspectRatio = value;
}
break;
case ListenerFireEventBase.eventIdPropertyKey:
if (object is ListenerFireEventBase && value is int) {
object.eventId = value;
@ -1245,31 +1398,6 @@ class RiveCoreContext {
object.clip = value;
}
break;
case LayoutComponentBase.layoutFlags0PropertyKey:
if (object is LayoutComponentBase && value is int) {
object.layoutFlags0 = value;
}
break;
case LayoutComponentBase.layoutFlags1PropertyKey:
if (object is LayoutComponentBase && value is int) {
object.layoutFlags1 = value;
}
break;
case LayoutComponentBase.layoutFlags2PropertyKey:
if (object is LayoutComponentBase && value is int) {
object.layoutFlags2 = value;
}
break;
case LayoutComponentBase.gapWidthPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.gapWidth = value;
}
break;
case LayoutComponentBase.gapHeightPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.gapHeight = value;
}
break;
case LayoutComponentBase.widthPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.width = value;
@ -1280,119 +1408,9 @@ class RiveCoreContext {
object.height = value;
}
break;
case LayoutComponentBase.maxWidthPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.maxWidth = value;
}
break;
case LayoutComponentBase.maxHeightPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.maxHeight = value;
}
break;
case LayoutComponentBase.minWidthPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.minWidth = value;
}
break;
case LayoutComponentBase.minHeightPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.minHeight = value;
}
break;
case LayoutComponentBase.marginLeftPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.marginLeft = value;
}
break;
case LayoutComponentBase.marginRightPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.marginRight = value;
}
break;
case LayoutComponentBase.marginTopPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.marginTop = value;
}
break;
case LayoutComponentBase.marginBottomPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.marginBottom = value;
}
break;
case LayoutComponentBase.paddingLeftPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.paddingLeft = value;
}
break;
case LayoutComponentBase.paddingRightPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.paddingRight = value;
}
break;
case LayoutComponentBase.paddingTopPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.paddingTop = value;
}
break;
case LayoutComponentBase.paddingBottomPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.paddingBottom = value;
}
break;
case LayoutComponentBase.insetLeftPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.insetLeft = value;
}
break;
case LayoutComponentBase.insetRightPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.insetRight = value;
}
break;
case LayoutComponentBase.insetTopPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.insetTop = value;
}
break;
case LayoutComponentBase.insetBottomPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.insetBottom = value;
}
break;
case LayoutComponentBase.flexGrowPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.flexGrow = value;
}
break;
case LayoutComponentBase.flexShrinkPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.flexShrink = value;
}
break;
case LayoutComponentBase.aspectRatioPropertyKey:
if (object is LayoutComponentBase && value is double) {
object.aspectRatio = value;
}
break;
case LayoutComponentBase.gridRowStartPropertyKey:
case LayoutComponentBase.styleIdPropertyKey:
if (object is LayoutComponentBase && value is int) {
object.gridRowStart = value;
}
break;
case LayoutComponentBase.gridRowEndPropertyKey:
if (object is LayoutComponentBase && value is int) {
object.gridRowEnd = value;
}
break;
case LayoutComponentBase.gridColumnStartPropertyKey:
if (object is LayoutComponentBase && value is int) {
object.gridColumnStart = value;
}
break;
case LayoutComponentBase.gridColumnEndPropertyKey:
if (object is LayoutComponentBase && value is int) {
object.gridColumnEnd = value;
object.styleId = value;
}
break;
case ArtboardBase.xPropertyKey:
@ -1856,6 +1874,9 @@ class RiveCoreContext {
case NestedArtboardBase.artboardIdPropertyKey:
case NestedAnimationBase.animationIdPropertyKey:
case SoloBase.activeComponentIdPropertyKey:
case LayoutComponentStyleBase.layoutFlags0PropertyKey:
case LayoutComponentStyleBase.layoutFlags1PropertyKey:
case LayoutComponentStyleBase.layoutFlags2PropertyKey:
case ListenerFireEventBase.eventIdPropertyKey:
case LinearAnimationBase.fpsPropertyKey:
case LinearAnimationBase.durationPropertyKey:
@ -1909,13 +1930,7 @@ class RiveCoreContext {
case PolygonBase.pointsPropertyKey:
case ImageBase.assetIdPropertyKey:
case DrawRulesBase.drawTargetIdPropertyKey:
case LayoutComponentBase.layoutFlags0PropertyKey:
case LayoutComponentBase.layoutFlags1PropertyKey:
case LayoutComponentBase.layoutFlags2PropertyKey:
case LayoutComponentBase.gridRowStartPropertyKey:
case LayoutComponentBase.gridRowEndPropertyKey:
case LayoutComponentBase.gridColumnStartPropertyKey:
case LayoutComponentBase.gridColumnEndPropertyKey:
case LayoutComponentBase.styleIdPropertyKey:
case ArtboardBase.defaultStateMachineIdPropertyKey:
case JoystickBase.xIdPropertyKey:
case JoystickBase.yIdPropertyKey:
@ -1959,6 +1974,33 @@ class RiveCoreContext {
case TransformComponentBase.scaleYPropertyKey:
case NodeBase.xPropertyKey:
case NodeBase.yPropertyKey:
case LayoutComponentStyleBase.gapHorizontalPropertyKey:
case LayoutComponentStyleBase.gapVerticalPropertyKey:
case LayoutComponentStyleBase.maxWidthPropertyKey:
case LayoutComponentStyleBase.maxHeightPropertyKey:
case LayoutComponentStyleBase.minWidthPropertyKey:
case LayoutComponentStyleBase.minHeightPropertyKey:
case LayoutComponentStyleBase.borderLeftPropertyKey:
case LayoutComponentStyleBase.borderRightPropertyKey:
case LayoutComponentStyleBase.borderTopPropertyKey:
case LayoutComponentStyleBase.borderBottomPropertyKey:
case LayoutComponentStyleBase.marginLeftPropertyKey:
case LayoutComponentStyleBase.marginRightPropertyKey:
case LayoutComponentStyleBase.marginTopPropertyKey:
case LayoutComponentStyleBase.marginBottomPropertyKey:
case LayoutComponentStyleBase.paddingLeftPropertyKey:
case LayoutComponentStyleBase.paddingRightPropertyKey:
case LayoutComponentStyleBase.paddingTopPropertyKey:
case LayoutComponentStyleBase.paddingBottomPropertyKey:
case LayoutComponentStyleBase.positionLeftPropertyKey:
case LayoutComponentStyleBase.positionRightPropertyKey:
case LayoutComponentStyleBase.positionTopPropertyKey:
case LayoutComponentStyleBase.positionBottomPropertyKey:
case LayoutComponentStyleBase.flexPropertyKey:
case LayoutComponentStyleBase.flexGrowPropertyKey:
case LayoutComponentStyleBase.flexShrinkPropertyKey:
case LayoutComponentStyleBase.flexBasisPropertyKey:
case LayoutComponentStyleBase.aspectRatioPropertyKey:
case LinearAnimationBase.speedPropertyKey:
case NestedLinearAnimationBase.mixPropertyKey:
case NestedSimpleAnimationBase.speedPropertyKey:
@ -2017,29 +2059,8 @@ class RiveCoreContext {
case CubicDetachedVertexBase.inDistancePropertyKey:
case CubicDetachedVertexBase.outRotationPropertyKey:
case CubicDetachedVertexBase.outDistancePropertyKey:
case LayoutComponentBase.gapWidthPropertyKey:
case LayoutComponentBase.gapHeightPropertyKey:
case LayoutComponentBase.widthPropertyKey:
case LayoutComponentBase.heightPropertyKey:
case LayoutComponentBase.maxWidthPropertyKey:
case LayoutComponentBase.maxHeightPropertyKey:
case LayoutComponentBase.minWidthPropertyKey:
case LayoutComponentBase.minHeightPropertyKey:
case LayoutComponentBase.marginLeftPropertyKey:
case LayoutComponentBase.marginRightPropertyKey:
case LayoutComponentBase.marginTopPropertyKey:
case LayoutComponentBase.marginBottomPropertyKey:
case LayoutComponentBase.paddingLeftPropertyKey:
case LayoutComponentBase.paddingRightPropertyKey:
case LayoutComponentBase.paddingTopPropertyKey:
case LayoutComponentBase.paddingBottomPropertyKey:
case LayoutComponentBase.insetLeftPropertyKey:
case LayoutComponentBase.insetRightPropertyKey:
case LayoutComponentBase.insetTopPropertyKey:
case LayoutComponentBase.insetBottomPropertyKey:
case LayoutComponentBase.flexGrowPropertyKey:
case LayoutComponentBase.flexShrinkPropertyKey:
case LayoutComponentBase.aspectRatioPropertyKey:
case ArtboardBase.xPropertyKey:
case ArtboardBase.yPropertyKey:
case ArtboardBase.originXPropertyKey:
@ -2199,6 +2220,12 @@ class RiveCoreContext {
return (object as NestedAnimationBase).animationId;
case SoloBase.activeComponentIdPropertyKey:
return (object as SoloBase).activeComponentId;
case LayoutComponentStyleBase.layoutFlags0PropertyKey:
return (object as LayoutComponentStyleBase).layoutFlags0;
case LayoutComponentStyleBase.layoutFlags1PropertyKey:
return (object as LayoutComponentStyleBase).layoutFlags1;
case LayoutComponentStyleBase.layoutFlags2PropertyKey:
return (object as LayoutComponentStyleBase).layoutFlags2;
case ListenerFireEventBase.eventIdPropertyKey:
return (object as ListenerFireEventBase).eventId;
case LinearAnimationBase.fpsPropertyKey:
@ -2305,20 +2332,8 @@ class RiveCoreContext {
return (object as ImageBase).assetId;
case DrawRulesBase.drawTargetIdPropertyKey:
return (object as DrawRulesBase).drawTargetId;
case LayoutComponentBase.layoutFlags0PropertyKey:
return (object as LayoutComponentBase).layoutFlags0;
case LayoutComponentBase.layoutFlags1PropertyKey:
return (object as LayoutComponentBase).layoutFlags1;
case LayoutComponentBase.layoutFlags2PropertyKey:
return (object as LayoutComponentBase).layoutFlags2;
case LayoutComponentBase.gridRowStartPropertyKey:
return (object as LayoutComponentBase).gridRowStart;
case LayoutComponentBase.gridRowEndPropertyKey:
return (object as LayoutComponentBase).gridRowEnd;
case LayoutComponentBase.gridColumnStartPropertyKey:
return (object as LayoutComponentBase).gridColumnStart;
case LayoutComponentBase.gridColumnEndPropertyKey:
return (object as LayoutComponentBase).gridColumnEnd;
case LayoutComponentBase.styleIdPropertyKey:
return (object as LayoutComponentBase).styleId;
case ArtboardBase.defaultStateMachineIdPropertyKey:
return (object as ArtboardBase).defaultStateMachineId;
case JoystickBase.xIdPropertyKey:
@ -2409,6 +2424,60 @@ class RiveCoreContext {
return (object as NodeBase).x;
case NodeBase.yPropertyKey:
return (object as NodeBase).y;
case LayoutComponentStyleBase.gapHorizontalPropertyKey:
return (object as LayoutComponentStyleBase).gapHorizontal;
case LayoutComponentStyleBase.gapVerticalPropertyKey:
return (object as LayoutComponentStyleBase).gapVertical;
case LayoutComponentStyleBase.maxWidthPropertyKey:
return (object as LayoutComponentStyleBase).maxWidth;
case LayoutComponentStyleBase.maxHeightPropertyKey:
return (object as LayoutComponentStyleBase).maxHeight;
case LayoutComponentStyleBase.minWidthPropertyKey:
return (object as LayoutComponentStyleBase).minWidth;
case LayoutComponentStyleBase.minHeightPropertyKey:
return (object as LayoutComponentStyleBase).minHeight;
case LayoutComponentStyleBase.borderLeftPropertyKey:
return (object as LayoutComponentStyleBase).borderLeft;
case LayoutComponentStyleBase.borderRightPropertyKey:
return (object as LayoutComponentStyleBase).borderRight;
case LayoutComponentStyleBase.borderTopPropertyKey:
return (object as LayoutComponentStyleBase).borderTop;
case LayoutComponentStyleBase.borderBottomPropertyKey:
return (object as LayoutComponentStyleBase).borderBottom;
case LayoutComponentStyleBase.marginLeftPropertyKey:
return (object as LayoutComponentStyleBase).marginLeft;
case LayoutComponentStyleBase.marginRightPropertyKey:
return (object as LayoutComponentStyleBase).marginRight;
case LayoutComponentStyleBase.marginTopPropertyKey:
return (object as LayoutComponentStyleBase).marginTop;
case LayoutComponentStyleBase.marginBottomPropertyKey:
return (object as LayoutComponentStyleBase).marginBottom;
case LayoutComponentStyleBase.paddingLeftPropertyKey:
return (object as LayoutComponentStyleBase).paddingLeft;
case LayoutComponentStyleBase.paddingRightPropertyKey:
return (object as LayoutComponentStyleBase).paddingRight;
case LayoutComponentStyleBase.paddingTopPropertyKey:
return (object as LayoutComponentStyleBase).paddingTop;
case LayoutComponentStyleBase.paddingBottomPropertyKey:
return (object as LayoutComponentStyleBase).paddingBottom;
case LayoutComponentStyleBase.positionLeftPropertyKey:
return (object as LayoutComponentStyleBase).positionLeft;
case LayoutComponentStyleBase.positionRightPropertyKey:
return (object as LayoutComponentStyleBase).positionRight;
case LayoutComponentStyleBase.positionTopPropertyKey:
return (object as LayoutComponentStyleBase).positionTop;
case LayoutComponentStyleBase.positionBottomPropertyKey:
return (object as LayoutComponentStyleBase).positionBottom;
case LayoutComponentStyleBase.flexPropertyKey:
return (object as LayoutComponentStyleBase).flex;
case LayoutComponentStyleBase.flexGrowPropertyKey:
return (object as LayoutComponentStyleBase).flexGrow;
case LayoutComponentStyleBase.flexShrinkPropertyKey:
return (object as LayoutComponentStyleBase).flexShrink;
case LayoutComponentStyleBase.flexBasisPropertyKey:
return (object as LayoutComponentStyleBase).flexBasis;
case LayoutComponentStyleBase.aspectRatioPropertyKey:
return (object as LayoutComponentStyleBase).aspectRatio;
case LinearAnimationBase.speedPropertyKey:
return (object as LinearAnimationBase).speed;
case NestedLinearAnimationBase.mixPropertyKey:
@ -2525,52 +2594,10 @@ class RiveCoreContext {
return (object as CubicDetachedVertexBase).outRotation;
case CubicDetachedVertexBase.outDistancePropertyKey:
return (object as CubicDetachedVertexBase).outDistance;
case LayoutComponentBase.gapWidthPropertyKey:
return (object as LayoutComponentBase).gapWidth;
case LayoutComponentBase.gapHeightPropertyKey:
return (object as LayoutComponentBase).gapHeight;
case LayoutComponentBase.widthPropertyKey:
return (object as LayoutComponentBase).width;
case LayoutComponentBase.heightPropertyKey:
return (object as LayoutComponentBase).height;
case LayoutComponentBase.maxWidthPropertyKey:
return (object as LayoutComponentBase).maxWidth;
case LayoutComponentBase.maxHeightPropertyKey:
return (object as LayoutComponentBase).maxHeight;
case LayoutComponentBase.minWidthPropertyKey:
return (object as LayoutComponentBase).minWidth;
case LayoutComponentBase.minHeightPropertyKey:
return (object as LayoutComponentBase).minHeight;
case LayoutComponentBase.marginLeftPropertyKey:
return (object as LayoutComponentBase).marginLeft;
case LayoutComponentBase.marginRightPropertyKey:
return (object as LayoutComponentBase).marginRight;
case LayoutComponentBase.marginTopPropertyKey:
return (object as LayoutComponentBase).marginTop;
case LayoutComponentBase.marginBottomPropertyKey:
return (object as LayoutComponentBase).marginBottom;
case LayoutComponentBase.paddingLeftPropertyKey:
return (object as LayoutComponentBase).paddingLeft;
case LayoutComponentBase.paddingRightPropertyKey:
return (object as LayoutComponentBase).paddingRight;
case LayoutComponentBase.paddingTopPropertyKey:
return (object as LayoutComponentBase).paddingTop;
case LayoutComponentBase.paddingBottomPropertyKey:
return (object as LayoutComponentBase).paddingBottom;
case LayoutComponentBase.insetLeftPropertyKey:
return (object as LayoutComponentBase).insetLeft;
case LayoutComponentBase.insetRightPropertyKey:
return (object as LayoutComponentBase).insetRight;
case LayoutComponentBase.insetTopPropertyKey:
return (object as LayoutComponentBase).insetTop;
case LayoutComponentBase.insetBottomPropertyKey:
return (object as LayoutComponentBase).insetBottom;
case LayoutComponentBase.flexGrowPropertyKey:
return (object as LayoutComponentBase).flexGrow;
case LayoutComponentBase.flexShrinkPropertyKey:
return (object as LayoutComponentBase).flexShrink;
case LayoutComponentBase.aspectRatioPropertyKey:
return (object as LayoutComponentBase).aspectRatio;
case ArtboardBase.xPropertyKey:
return (object as ArtboardBase).x;
case ArtboardBase.yPropertyKey:
@ -2881,6 +2908,21 @@ class RiveCoreContext {
object.activeComponentId = value;
}
break;
case LayoutComponentStyleBase.layoutFlags0PropertyKey:
if (object is LayoutComponentStyleBase) {
object.layoutFlags0 = value;
}
break;
case LayoutComponentStyleBase.layoutFlags1PropertyKey:
if (object is LayoutComponentStyleBase) {
object.layoutFlags1 = value;
}
break;
case LayoutComponentStyleBase.layoutFlags2PropertyKey:
if (object is LayoutComponentStyleBase) {
object.layoutFlags2 = value;
}
break;
case ListenerFireEventBase.eventIdPropertyKey:
if (object is ListenerFireEventBase) {
object.eventId = value;
@ -3146,39 +3188,9 @@ class RiveCoreContext {
object.drawTargetId = value;
}
break;
case LayoutComponentBase.layoutFlags0PropertyKey:
case LayoutComponentBase.styleIdPropertyKey:
if (object is LayoutComponentBase) {
object.layoutFlags0 = value;
}
break;
case LayoutComponentBase.layoutFlags1PropertyKey:
if (object is LayoutComponentBase) {
object.layoutFlags1 = value;
}
break;
case LayoutComponentBase.layoutFlags2PropertyKey:
if (object is LayoutComponentBase) {
object.layoutFlags2 = value;
}
break;
case LayoutComponentBase.gridRowStartPropertyKey:
if (object is LayoutComponentBase) {
object.gridRowStart = value;
}
break;
case LayoutComponentBase.gridRowEndPropertyKey:
if (object is LayoutComponentBase) {
object.gridRowEnd = value;
}
break;
case LayoutComponentBase.gridColumnStartPropertyKey:
if (object is LayoutComponentBase) {
object.gridColumnStart = value;
}
break;
case LayoutComponentBase.gridColumnEndPropertyKey:
if (object is LayoutComponentBase) {
object.gridColumnEnd = value;
object.styleId = value;
}
break;
case ArtboardBase.defaultStateMachineIdPropertyKey:
@ -3396,6 +3408,141 @@ class RiveCoreContext {
object.y = value;
}
break;
case LayoutComponentStyleBase.gapHorizontalPropertyKey:
if (object is LayoutComponentStyleBase) {
object.gapHorizontal = value;
}
break;
case LayoutComponentStyleBase.gapVerticalPropertyKey:
if (object is LayoutComponentStyleBase) {
object.gapVertical = value;
}
break;
case LayoutComponentStyleBase.maxWidthPropertyKey:
if (object is LayoutComponentStyleBase) {
object.maxWidth = value;
}
break;
case LayoutComponentStyleBase.maxHeightPropertyKey:
if (object is LayoutComponentStyleBase) {
object.maxHeight = value;
}
break;
case LayoutComponentStyleBase.minWidthPropertyKey:
if (object is LayoutComponentStyleBase) {
object.minWidth = value;
}
break;
case LayoutComponentStyleBase.minHeightPropertyKey:
if (object is LayoutComponentStyleBase) {
object.minHeight = value;
}
break;
case LayoutComponentStyleBase.borderLeftPropertyKey:
if (object is LayoutComponentStyleBase) {
object.borderLeft = value;
}
break;
case LayoutComponentStyleBase.borderRightPropertyKey:
if (object is LayoutComponentStyleBase) {
object.borderRight = value;
}
break;
case LayoutComponentStyleBase.borderTopPropertyKey:
if (object is LayoutComponentStyleBase) {
object.borderTop = value;
}
break;
case LayoutComponentStyleBase.borderBottomPropertyKey:
if (object is LayoutComponentStyleBase) {
object.borderBottom = value;
}
break;
case LayoutComponentStyleBase.marginLeftPropertyKey:
if (object is LayoutComponentStyleBase) {
object.marginLeft = value;
}
break;
case LayoutComponentStyleBase.marginRightPropertyKey:
if (object is LayoutComponentStyleBase) {
object.marginRight = value;
}
break;
case LayoutComponentStyleBase.marginTopPropertyKey:
if (object is LayoutComponentStyleBase) {
object.marginTop = value;
}
break;
case LayoutComponentStyleBase.marginBottomPropertyKey:
if (object is LayoutComponentStyleBase) {
object.marginBottom = value;
}
break;
case LayoutComponentStyleBase.paddingLeftPropertyKey:
if (object is LayoutComponentStyleBase) {
object.paddingLeft = value;
}
break;
case LayoutComponentStyleBase.paddingRightPropertyKey:
if (object is LayoutComponentStyleBase) {
object.paddingRight = value;
}
break;
case LayoutComponentStyleBase.paddingTopPropertyKey:
if (object is LayoutComponentStyleBase) {
object.paddingTop = value;
}
break;
case LayoutComponentStyleBase.paddingBottomPropertyKey:
if (object is LayoutComponentStyleBase) {
object.paddingBottom = value;
}
break;
case LayoutComponentStyleBase.positionLeftPropertyKey:
if (object is LayoutComponentStyleBase) {
object.positionLeft = value;
}
break;
case LayoutComponentStyleBase.positionRightPropertyKey:
if (object is LayoutComponentStyleBase) {
object.positionRight = value;
}
break;
case LayoutComponentStyleBase.positionTopPropertyKey:
if (object is LayoutComponentStyleBase) {
object.positionTop = value;
}
break;
case LayoutComponentStyleBase.positionBottomPropertyKey:
if (object is LayoutComponentStyleBase) {
object.positionBottom = value;
}
break;
case LayoutComponentStyleBase.flexPropertyKey:
if (object is LayoutComponentStyleBase) {
object.flex = value;
}
break;
case LayoutComponentStyleBase.flexGrowPropertyKey:
if (object is LayoutComponentStyleBase) {
object.flexGrow = value;
}
break;
case LayoutComponentStyleBase.flexShrinkPropertyKey:
if (object is LayoutComponentStyleBase) {
object.flexShrink = value;
}
break;
case LayoutComponentStyleBase.flexBasisPropertyKey:
if (object is LayoutComponentStyleBase) {
object.flexBasis = value;
}
break;
case LayoutComponentStyleBase.aspectRatioPropertyKey:
if (object is LayoutComponentStyleBase) {
object.aspectRatio = value;
}
break;
case LinearAnimationBase.speedPropertyKey:
if (object is LinearAnimationBase) {
object.speed = value;
@ -3686,16 +3833,6 @@ class RiveCoreContext {
object.outDistance = value;
}
break;
case LayoutComponentBase.gapWidthPropertyKey:
if (object is LayoutComponentBase) {
object.gapWidth = value;
}
break;
case LayoutComponentBase.gapHeightPropertyKey:
if (object is LayoutComponentBase) {
object.gapHeight = value;
}
break;
case LayoutComponentBase.widthPropertyKey:
if (object is LayoutComponentBase) {
object.width = value;
@ -3706,101 +3843,6 @@ class RiveCoreContext {
object.height = value;
}
break;
case LayoutComponentBase.maxWidthPropertyKey:
if (object is LayoutComponentBase) {
object.maxWidth = value;
}
break;
case LayoutComponentBase.maxHeightPropertyKey:
if (object is LayoutComponentBase) {
object.maxHeight = value;
}
break;
case LayoutComponentBase.minWidthPropertyKey:
if (object is LayoutComponentBase) {
object.minWidth = value;
}
break;
case LayoutComponentBase.minHeightPropertyKey:
if (object is LayoutComponentBase) {
object.minHeight = value;
}
break;
case LayoutComponentBase.marginLeftPropertyKey:
if (object is LayoutComponentBase) {
object.marginLeft = value;
}
break;
case LayoutComponentBase.marginRightPropertyKey:
if (object is LayoutComponentBase) {
object.marginRight = value;
}
break;
case LayoutComponentBase.marginTopPropertyKey:
if (object is LayoutComponentBase) {
object.marginTop = value;
}
break;
case LayoutComponentBase.marginBottomPropertyKey:
if (object is LayoutComponentBase) {
object.marginBottom = value;
}
break;
case LayoutComponentBase.paddingLeftPropertyKey:
if (object is LayoutComponentBase) {
object.paddingLeft = value;
}
break;
case LayoutComponentBase.paddingRightPropertyKey:
if (object is LayoutComponentBase) {
object.paddingRight = value;
}
break;
case LayoutComponentBase.paddingTopPropertyKey:
if (object is LayoutComponentBase) {
object.paddingTop = value;
}
break;
case LayoutComponentBase.paddingBottomPropertyKey:
if (object is LayoutComponentBase) {
object.paddingBottom = value;
}
break;
case LayoutComponentBase.insetLeftPropertyKey:
if (object is LayoutComponentBase) {
object.insetLeft = value;
}
break;
case LayoutComponentBase.insetRightPropertyKey:
if (object is LayoutComponentBase) {
object.insetRight = value;
}
break;
case LayoutComponentBase.insetTopPropertyKey:
if (object is LayoutComponentBase) {
object.insetTop = value;
}
break;
case LayoutComponentBase.insetBottomPropertyKey:
if (object is LayoutComponentBase) {
object.insetBottom = value;
}
break;
case LayoutComponentBase.flexGrowPropertyKey:
if (object is LayoutComponentBase) {
object.flexGrow = value;
}
break;
case LayoutComponentBase.flexShrinkPropertyKey:
if (object is LayoutComponentBase) {
object.flexShrink = value;
}
break;
case LayoutComponentBase.aspectRatioPropertyKey:
if (object is LayoutComponentBase) {
object.aspectRatio = value;
}
break;
case ArtboardBase.xPropertyKey:
if (object is ArtboardBase) {
object.x = value;

View File

@ -16,16 +16,24 @@ 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/joystick.dart';
import 'package:rive/src/rive_core/layout_component.dart';
import 'package:rive/src/rive_core/nested_artboard.dart';
import 'package:rive/src/rive_core/rive_animation_controller.dart';
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
import 'package:rive_common/layout_engine.dart';
import 'package:rive_common/math.dart';
import 'package:rive_common/utilities.dart';
export 'package:rive/src/generated/artboard_base.dart';
class Artboard extends ArtboardBase with ShapePaintContainer {
final Set<LayoutComponent> _dirtyLayout = {};
void markLayoutDirty(LayoutComponent layoutComponent) {
_dirtyLayout.add(layoutComponent);
}
bool _frameOrigin = true;
bool hasChangedDrawOrderInLastUpdate = false;
@ -194,7 +202,21 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
/// Update any dirty components in this artboard.
bool advance(double elapsedSeconds, {bool nested = false}) {
if (_dirtyLayout.isNotEmpty) {
var dirtyLayout = _dirtyLayout.toList();
_dirtyLayout.clear();
syncStyle();
for (final layoutComponent in dirtyLayout) {
layoutComponent.syncStyle();
}
layoutNode.calculateLayout(width, height, LayoutDirection.ltr);
// Need to sync all layout positions.
for (final layout in _dependencyOrder.whereType<LayoutComponent>()) {
layout.updateLayoutBounds();
}
}
bool didUpdate = false;
for (final controller in _animationControllers) {
if (controller.isActive) {
controller.apply(context, elapsedSeconds);

View File

@ -34,6 +34,15 @@ class AudioAsset extends AudioAssetBase {
return 'wav';
}
@override
void onAssetError() {}
static AudioContainerFormat containerFormatFromName(String name) {
switch (name) {
case 'flac':
return AudioContainerFormat.flac;
case 'mp3':
return AudioContainerFormat.mp3;
case 'wav':
return AudioContainerFormat.wav;
}
return AudioContainerFormat.unknown;
}
}

View File

@ -84,7 +84,9 @@ abstract class FileAssetReferencer<T extends FileAsset> {
int get assetId;
set assetId(int value);
set asset(T? value) {
set asset(T? value) => setAsset(value);
void setAsset(T? value, {bool changeId = true}) {
if (_asset == value) {
return;
}
@ -92,8 +94,9 @@ abstract class FileAssetReferencer<T extends FileAsset> {
_asset = value;
_asset?.registerFileAssetReferencer(this);
assetId = value?.id ?? Core.missingId;
if (changeId) {
assetId = value?.id ?? Core.missingId;
}
}
/// Get the Core typeKey for the property that stores the assetId on the

View File

@ -1,7 +1,9 @@
import 'package:rive/src/core/core.dart';
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';
import 'package:rive/src/rive_core/audio_player.dart';
export 'package:rive/src/generated/audio_event_base.dart';
@ -26,4 +28,16 @@ class AudioEvent extends AudioEventBase with FileAssetReferencer<AudioAsset> {
@override
int get assetIdPropertyKey => AudioEventBase.assetIdPropertyKey;
@override
bool import(ImportStack stack) {
if (!registerWithImporter(stack)) {
return false;
}
return super.import(stack);
}
void play(AudioPlayer player) {
player.playSource(asset);
}
}

View File

@ -0,0 +1,129 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rive/src/rive_core/assets/audio_asset.dart';
import 'package:rive_common/rive_audio.dart';
class AudioPlayer {
final ValueNotifier<Duration> time = ValueNotifier(Duration.zero);
final ValueNotifier<double> normalizedTime = ValueNotifier(0);
final ValueNotifier<bool> isPlaying = ValueNotifier(false);
AudioEngine? _engine;
AudioEngine? get engine => _engine;
final List<AudioSound> _sounds = [];
int _soundStartTime = 0;
Duration _soundDuration = Duration.zero;
Duration? _soundEndTime;
Timer? _timer;
AudioPlayer({required AudioEngine? engine}) : _engine = engine;
static AudioPlayer? make() {
var engine = AudioEngine.init(2, AudioEngine.playbackSampleRate);
if (engine == null) {
return null;
}
return AudioPlayer(engine: engine);
}
double get engineTimeInSeconds {
var engine = this.engine;
if (engine == null) {
return 0;
}
return engine.timeInFrames / engine.sampleRate;
}
void playBuffered(
BufferedAudioSource source, {
Duration startTime = Duration.zero,
Duration? endTime,
}) {
var engine = this.engine;
if (engine == null) {
return;
}
if (startTime > source.duration) {
return;
}
var engineTime = engine.timeInFrames;
isPlaying.value = true;
var sound = engine.play(source, engineTime, 0,
(startTime.inMicroseconds * 1e-6 * engine.sampleRate).round());
_sounds.add(sound);
_soundDuration = source.duration;
_soundStartTime = engineTime -
(startTime.inMicroseconds * 1e-6 * engine.sampleRate).round();
_soundEndTime = endTime;
_timer = Timer.periodic(const Duration(milliseconds: 0), _frameCallback);
}
bool playSource(AudioAsset? audio) {
var source = audio?.audioSource.value;
if (source == null) {
return false;
}
var engine = this.engine;
if (engine == null) {
return false;
}
var engineTime = engine.timeInFrames;
var sound = engine.play(source, engineTime, 0, 0);
_sounds.add(sound);
return true;
}
void _frameCallback(Timer timer) {
var engine = this.engine;
if (engine == null) {
return;
}
var elapsedAudioFrames = engine.timeInFrames - _soundStartTime;
time.value = Duration(
microseconds: (elapsedAudioFrames / engine.sampleRate / 1e-6).floor());
normalizedTime.value = _soundDuration == Duration.zero
? 0
: (time.value.inMicroseconds / _soundDuration.inMicroseconds)
.clamp(0, 1);
if (_soundEndTime != null) {
if (time.value > _soundEndTime!) {
stop();
}
}
if (time.value > _soundDuration && _sounds.length == 1) {
stop();
}
}
void stop() {
isPlaying.value = false;
_timer?.cancel();
_timer = null;
_soundEndTime = null;
time.value = Duration.zero;
normalizedTime.value = 0;
for (final sound in _sounds) {
sound.stop();
sound.dispose();
}
_sounds.clear();
}
void dispose() {
var engine = this.engine;
if (engine == null) {
return;
}
stop();
engine.dispose();
_engine = null;
}
}

View File

@ -0,0 +1,332 @@
import 'package:rive/src/generated/layout/layout_component_style_base.dart';
import 'package:rive/src/rive_core/notifier.dart';
import 'package:rive_common/layout_engine.dart';
import 'package:rive_common/math.dart';
export 'package:rive/src/generated/layout/layout_component_style_base.dart';
class LayoutComponentStyle extends LayoutComponentStyleBase {
Notifier valueChanged = Notifier();
// ---- Flags 0
static const BitFieldLoc displayBits = BitFieldLoc(0, 0);
static const BitFieldLoc positionTypeBits = BitFieldLoc(1, 2); // relative
static const BitFieldLoc flexDirectionBits = BitFieldLoc(3, 4); // row
static const BitFieldLoc directionBits = BitFieldLoc(5, 6);
static const BitFieldLoc alignContentBits = BitFieldLoc(7, 9);
static const BitFieldLoc alignItemsBits = BitFieldLoc(10, 12); // flexStart
static const BitFieldLoc alignSelfBits = BitFieldLoc(13, 15);
static const BitFieldLoc justifyContentBits =
BitFieldLoc(16, 18); // flexStart
static const BitFieldLoc flexWrapBits = BitFieldLoc(19, 20);
static const BitFieldLoc overflowBits = BitFieldLoc(21, 22);
static const BitFieldLoc intrinsicallySizedBits = BitFieldLoc(23, 23);
static const BitFieldLoc widthUnitsBits = BitFieldLoc(24, 25); // points
static const BitFieldLoc heightUnitsBits = BitFieldLoc(26, 27); // points
// ---- Flags 1
static const BitFieldLoc borderLeftUnitsBits = BitFieldLoc(0, 1);
static const BitFieldLoc borderRightUnitsBits = BitFieldLoc(2, 3);
static const BitFieldLoc borderTopUnitsBits = BitFieldLoc(4, 5);
static const BitFieldLoc borderBottomUnitsBits = BitFieldLoc(6, 7);
static const BitFieldLoc marginLeftUnitsBits = BitFieldLoc(8, 9);
static const BitFieldLoc marginRightUnitsBits = BitFieldLoc(10, 11);
static const BitFieldLoc marginTopUnitsBits = BitFieldLoc(12, 13);
static const BitFieldLoc marginBottomUnitsBits = BitFieldLoc(14, 15);
static const BitFieldLoc paddingLeftUnitsBits = BitFieldLoc(16, 17);
static const BitFieldLoc paddingRightUnitsBits = BitFieldLoc(18, 19);
static const BitFieldLoc paddingTopUnitsBits = BitFieldLoc(20, 21);
static const BitFieldLoc paddingBottomUnitsBits = BitFieldLoc(22, 23);
static const BitFieldLoc positionLeftUnitsBits = BitFieldLoc(24, 25);
static const BitFieldLoc positionRightUnitsBits = BitFieldLoc(26, 27);
static const BitFieldLoc positionTopUnitsBits = BitFieldLoc(28, 29);
static const BitFieldLoc positionBottomUnitsBits = BitFieldLoc(30, 31);
// ---- Flags 2
static const BitFieldLoc gapHorizontalUnitsBits = BitFieldLoc(0, 1);
static const BitFieldLoc gapVerticalUnitsBits = BitFieldLoc(2, 3);
static const BitFieldLoc minWidthUnitsBits = BitFieldLoc(4, 5);
static const BitFieldLoc minHeightUnitsBits = BitFieldLoc(6, 7);
static const BitFieldLoc maxWidthUnitsBits = BitFieldLoc(8, 9);
static const BitFieldLoc maxHeightUnitsBits = BitFieldLoc(10, 11);
LayoutDisplay get display =>
LayoutDisplay.values[displayBits.read(layoutFlags0)];
set display(LayoutDisplay value) =>
layoutFlags0 = displayBits.write(layoutFlags0, value.index);
LayoutPosition get positionType =>
LayoutPosition.values[positionTypeBits.read(layoutFlags0)];
set positionType(LayoutPosition value) =>
layoutFlags0 = positionTypeBits.write(layoutFlags0, value.index);
LayoutFlexDirection get flexDirection =>
LayoutFlexDirection.values[flexDirectionBits.read(layoutFlags0)];
set flexDirection(LayoutFlexDirection value) =>
layoutFlags0 = flexDirectionBits.write(layoutFlags0, value.index);
LayoutDirection get direction =>
LayoutDirection.values[directionBits.read(layoutFlags0)];
set direction(LayoutDirection value) =>
layoutFlags0 = directionBits.write(layoutFlags0, value.index);
LayoutWrap get flexWrap => LayoutWrap.values[flexWrapBits.read(layoutFlags0)];
set flexWrap(LayoutWrap value) =>
layoutFlags0 = flexWrapBits.write(layoutFlags0, value.index);
LayoutAlign get alignItems =>
LayoutAlign.values[alignItemsBits.read(layoutFlags0)];
set alignItems(LayoutAlign value) =>
layoutFlags0 = alignItemsBits.write(layoutFlags0, value.index);
LayoutAlign get alignSelf =>
LayoutAlign.values[alignSelfBits.read(layoutFlags0)];
set alignSelf(LayoutAlign value) =>
layoutFlags0 = alignSelfBits.write(layoutFlags0, value.index);
LayoutAlign get alignContent =>
LayoutAlign.values[alignContentBits.read(layoutFlags0)];
set alignContent(LayoutAlign value) =>
layoutFlags0 = alignContentBits.write(layoutFlags0, value.index);
LayoutJustify get justifyContent =>
LayoutJustify.values[justifyContentBits.read(layoutFlags0)];
set justifyContent(LayoutJustify value) =>
layoutFlags0 = justifyContentBits.write(layoutFlags0, value.index);
bool get intrinsicallySized => intrinsicallySizedBits.read(layoutFlags0) == 1;
set intrinsicallySized(bool value) =>
intrinsicallySizedBits.write(layoutFlags0, value ? 1 : 0);
LayoutUnit get widthUnits =>
LayoutUnit.values[widthUnitsBits.read(layoutFlags0)];
set widthUnits(LayoutUnit value) =>
layoutFlags0 = widthUnitsBits.write(layoutFlags0, value.index);
LayoutUnit get heightUnits =>
LayoutUnit.values[heightUnitsBits.read(layoutFlags0)];
set heightUnits(LayoutUnit value) =>
layoutFlags0 = heightUnitsBits.write(layoutFlags0, value.index);
LayoutUnit get borderLeftUnits =>
LayoutUnit.values[borderLeftUnitsBits.read(layoutFlags1)];
set borderLeftUnits(LayoutUnit value) =>
layoutFlags1 = borderLeftUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get borderRightUnits =>
LayoutUnit.values[borderRightUnitsBits.read(layoutFlags1)];
set borderRightUnits(LayoutUnit value) =>
layoutFlags1 = borderRightUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get borderTopUnits =>
LayoutUnit.values[borderTopUnitsBits.read(layoutFlags1)];
set borderTopUnits(LayoutUnit value) =>
layoutFlags1 = borderTopUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get borderBottomUnits =>
LayoutUnit.values[borderBottomUnitsBits.read(layoutFlags1)];
set borderBottomUnits(LayoutUnit value) =>
layoutFlags1 = borderBottomUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get marginLeftUnits =>
LayoutUnit.values[marginLeftUnitsBits.read(layoutFlags1)];
set marginLeftUnits(LayoutUnit value) =>
layoutFlags1 = marginLeftUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get marginRightUnits =>
LayoutUnit.values[marginRightUnitsBits.read(layoutFlags1)];
set marginRightUnits(LayoutUnit value) =>
layoutFlags1 = marginRightUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get marginTopUnits =>
LayoutUnit.values[marginTopUnitsBits.read(layoutFlags1)];
set marginTopUnits(LayoutUnit value) =>
layoutFlags1 = marginTopUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get marginBottomUnits =>
LayoutUnit.values[marginBottomUnitsBits.read(layoutFlags1)];
set marginBottomUnits(LayoutUnit value) =>
layoutFlags1 = marginBottomUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get paddingLeftUnits =>
LayoutUnit.values[paddingLeftUnitsBits.read(layoutFlags1)];
set paddingLeftUnits(LayoutUnit value) =>
layoutFlags1 = paddingLeftUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get paddingRightUnits =>
LayoutUnit.values[paddingRightUnitsBits.read(layoutFlags1)];
set paddingRightUnits(LayoutUnit value) =>
layoutFlags1 = paddingRightUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get paddingTopUnits =>
LayoutUnit.values[paddingTopUnitsBits.read(layoutFlags1)];
set paddingTopUnits(LayoutUnit value) =>
layoutFlags1 = paddingTopUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get paddingBottomUnits =>
LayoutUnit.values[paddingBottomUnitsBits.read(layoutFlags1)];
set paddingBottomUnits(LayoutUnit value) =>
layoutFlags1 = paddingBottomUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get positionLeftUnits =>
LayoutUnit.values[positionLeftUnitsBits.read(layoutFlags1)];
set positionLeftUnits(LayoutUnit value) =>
layoutFlags1 = positionLeftUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get positionRightUnits =>
LayoutUnit.values[positionRightUnitsBits.read(layoutFlags1)];
set positionRightUnits(LayoutUnit value) =>
layoutFlags1 = positionRightUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get positionTopUnits =>
LayoutUnit.values[positionTopUnitsBits.read(layoutFlags1)];
set positionTopUnits(LayoutUnit value) =>
layoutFlags1 = positionTopUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get positionBottomUnits =>
LayoutUnit.values[positionBottomUnitsBits.read(layoutFlags1)];
set positionBottomUnits(LayoutUnit value) =>
layoutFlags1 = positionBottomUnitsBits.write(layoutFlags1, value.index);
LayoutUnit get gapHorizontalUnits =>
LayoutUnit.values[gapHorizontalUnitsBits.read(layoutFlags2)];
set gapHorizontalUnits(LayoutUnit value) =>
layoutFlags2 = gapHorizontalUnitsBits.write(layoutFlags2, value.index);
LayoutUnit get gapVerticalUnits =>
LayoutUnit.values[gapVerticalUnitsBits.read(layoutFlags2)];
set gapVerticalUnits(LayoutUnit value) =>
layoutFlags2 = gapVerticalUnitsBits.write(layoutFlags2, value.index);
LayoutUnit get minWidthUnits =>
LayoutUnit.values[minWidthUnitsBits.read(layoutFlags2)];
set minWidthUnits(LayoutUnit value) =>
layoutFlags2 = minWidthUnitsBits.write(layoutFlags2, value.index);
LayoutUnit get minHeightUnits =>
LayoutUnit.values[minHeightUnitsBits.read(layoutFlags2)];
set minHeightUnits(LayoutUnit value) =>
layoutFlags2 = minHeightUnitsBits.write(layoutFlags2, value.index);
LayoutUnit get maxWidthUnits =>
LayoutUnit.values[maxWidthUnitsBits.read(layoutFlags2)];
set maxWidthUnits(LayoutUnit value) =>
layoutFlags2 = maxWidthUnitsBits.write(layoutFlags2, value.index);
LayoutUnit get maxHeightUnits =>
LayoutUnit.values[maxHeightUnitsBits.read(layoutFlags2)];
set maxHeightUnits(LayoutUnit value) =>
layoutFlags2 = maxHeightUnitsBits.write(layoutFlags2, value.index);
void markLayoutNodeDirty() {
valueChanged.notify();
}
@override
void buildDependencies() {
super.buildDependencies();
parent?.addDependent(this);
}
@override
void onAdded() {}
@override
void onAddedDirty() {}
@override
void layoutFlags0Changed(int from, int to) => markLayoutNodeDirty();
@override
void layoutFlags1Changed(int from, int to) => markLayoutNodeDirty();
@override
void layoutFlags2Changed(int from, int to) => markLayoutNodeDirty();
@override
void flexChanged(double from, double to) => markLayoutNodeDirty();
@override
void flexGrowChanged(double from, double to) => markLayoutNodeDirty();
@override
void flexShrinkChanged(double from, double to) => markLayoutNodeDirty();
@override
void flexBasisChanged(double from, double to) => markLayoutNodeDirty();
@override
void aspectRatioChanged(double from, double to) => markLayoutNodeDirty();
@override
void minWidthChanged(double from, double to) => markLayoutNodeDirty();
@override
void maxWidthChanged(double from, double to) => markLayoutNodeDirty();
@override
void minHeightChanged(double from, double to) => markLayoutNodeDirty();
@override
void maxHeightChanged(double from, double to) => markLayoutNodeDirty();
@override
void gapHorizontalChanged(double from, double to) => markLayoutNodeDirty();
@override
void gapVerticalChanged(double from, double to) => markLayoutNodeDirty();
@override
void borderLeftChanged(double from, double to) => markLayoutNodeDirty();
@override
void borderTopChanged(double from, double to) => markLayoutNodeDirty();
@override
void borderRightChanged(double from, double to) => markLayoutNodeDirty();
@override
void borderBottomChanged(double from, double to) => markLayoutNodeDirty();
@override
void marginLeftChanged(double from, double to) => markLayoutNodeDirty();
@override
void marginTopChanged(double from, double to) => markLayoutNodeDirty();
@override
void marginRightChanged(double from, double to) => markLayoutNodeDirty();
@override
void marginBottomChanged(double from, double to) => markLayoutNodeDirty();
@override
void paddingLeftChanged(double from, double to) => markLayoutNodeDirty();
@override
void paddingTopChanged(double from, double to) => markLayoutNodeDirty();
@override
void paddingRightChanged(double from, double to) => markLayoutNodeDirty();
@override
void paddingBottomChanged(double from, double to) => markLayoutNodeDirty();
@override
void positionLeftChanged(double from, double to) => markLayoutNodeDirty();
@override
void positionTopChanged(double from, double to) => markLayoutNodeDirty();
@override
void positionRightChanged(double from, double to) => markLayoutNodeDirty();
@override
void positionBottomChanged(double from, double to) => markLayoutNodeDirty();
@override
void update(int dirt) {}
@override
String get defaultName => 'Layout Style';
}

View File

@ -2,155 +2,62 @@ import 'dart:math';
import 'package:flutter/rendering.dart';
import 'package:rive/src/generated/layout_component_base.dart';
import 'package:rive/src/rive_core/artboard.dart';
import 'package:rive/src/rive_core/bounds_provider.dart';
import 'package:rive/src/rive_core/component_dirt.dart';
import 'package:rive/src/rive_core/container_component.dart';
import 'package:rive/src/rive_core/layout/layout_component_style.dart';
import 'package:rive/src/rive_core/world_transform_component.dart';
import 'package:rive_common/layout_engine.dart';
import 'package:rive_common/math.dart';
export 'package:rive/src/generated/layout_component_base.dart';
class LayoutComponent extends LayoutComponentBase {
// ---- Flags 0
static const BitFieldLoc displayBits = BitFieldLoc(0, 1);
static const BitFieldLoc positionBits = BitFieldLoc(2, 2);
LayoutComponentStyle? _style;
LayoutComponentStyle? get style => _style;
set style(LayoutComponentStyle? style) {
_style = style;
styleId = style?.id ?? Core.missingId;
if (style != null) {
setupStyle(style);
}
}
static const BitFieldLoc flexDirectionBits = BitFieldLoc(3, 4);
static const BitFieldLoc gapWidthTypeBits = BitFieldLoc(5, 5);
static const BitFieldLoc gapHeightTypeBits = BitFieldLoc(6, 6);
static const BitFieldLoc widthTypeBits = BitFieldLoc(7, 8);
static const BitFieldLoc heightTypeBits = BitFieldLoc(9, 10);
static const BitFieldLoc maxWidthTypeBits = BitFieldLoc(11, 12);
static const BitFieldLoc maxHeightTypeBits = BitFieldLoc(13, 14);
static const BitFieldLoc minWidthTypeBits = BitFieldLoc(15, 16);
static const BitFieldLoc minHeightTypeBits = BitFieldLoc(17, 18);
// Layout Engine provides these
final LayoutStyle _layoutStyle = LayoutStyle.make();
LayoutStyle get layoutStyle => _layoutStyle;
final LayoutNode _layoutNode = LayoutNode.make();
LayoutNode get layoutNode => _layoutNode;
static const BitFieldLoc marginLeftTypeBits = BitFieldLoc(19, 20);
static const BitFieldLoc marginRightTypeBits = BitFieldLoc(21, 22);
static const BitFieldLoc marginTopTypeBits = BitFieldLoc(23, 24);
static const BitFieldLoc marginBottomTypeBits = BitFieldLoc(25, 26);
static const BitFieldLoc intrinsicallySizedBits = BitFieldLoc(27, 27);
static const BitFieldLoc alignItemsBits = BitFieldLoc(28, 30);
// ---- Flags 1
static const BitFieldLoc alignSelfBits = BitFieldLoc(0, 2);
static const BitFieldLoc justifyItemsBits = BitFieldLoc(3, 5);
static const BitFieldLoc justifySelfBits = BitFieldLoc(6, 8);
static const BitFieldLoc gridAutoFlowBits = BitFieldLoc(9, 10);
static const BitFieldLoc gridRowStartTypeBits = BitFieldLoc(11, 12);
static const BitFieldLoc gridRowEndTypeBits = BitFieldLoc(13, 14);
static const BitFieldLoc gridColumnStartTypeBits = BitFieldLoc(15, 16);
static const BitFieldLoc gridColumnEndTypeBits = BitFieldLoc(17, 18);
static const BitFieldLoc alignContentBits = BitFieldLoc(19, 22);
static const BitFieldLoc justifyContentBits = BitFieldLoc(23, 26);
static const BitFieldLoc flexWrapBits = BitFieldLoc(27, 28);
// ---- Flags 2
static const BitFieldLoc paddingLeftTypeBits = BitFieldLoc(0, 1);
static const BitFieldLoc paddingRightTypeBits = BitFieldLoc(2, 3);
static const BitFieldLoc paddingTopTypeBits = BitFieldLoc(4, 5);
static const BitFieldLoc paddingBottomTypeBits = BitFieldLoc(6, 7);
static const BitFieldLoc insetLeftTypeBits = BitFieldLoc(8, 9);
static const BitFieldLoc insetRightTypeBits = BitFieldLoc(10, 11);
static const BitFieldLoc insetTopTypeBits = BitFieldLoc(12, 13);
static const BitFieldLoc insetBottomTypeBits = BitFieldLoc(14, 15);
bool get intrinsicallySized => intrinsicallySizedBits.read(layoutFlags0) == 1;
set intrinsicallySized(bool value) =>
intrinsicallySizedBits.write(layoutFlags0, value ? 1 : 0);
void markLayoutNodeDirty() {
_layoutNode.markDirty();
artboard?.markLayoutDirty(this);
}
@override
void clipChanged(bool from, bool to) {}
void changeArtboard(Artboard? value) {
super.changeArtboard(value);
artboard?.markLayoutDirty(this);
if (parent is LayoutComponent) {
(parent as LayoutComponent).syncLayoutChildren();
}
}
@override
void gapHeightChanged(double from, double to) {}
void clipChanged(bool from, bool to) => markLayoutNodeDirty();
@override
void gapWidthChanged(double from, double to) {}
void heightChanged(double from, double to) => markLayoutNodeDirty();
@override
void layoutFlags0Changed(int from, int to) {}
void widthChanged(double from, double to) => markLayoutNodeDirty();
@override
void layoutFlags1Changed(int from, int to) {}
@override
void layoutFlags2Changed(int from, int to) {}
@override
void heightChanged(double from, double to) {}
@override
void widthChanged(double from, double to) {}
@override
void maxHeightChanged(double from, double to) {}
@override
void maxWidthChanged(double from, double to) {}
@override
void minHeightChanged(double from, double to) {}
@override
void minWidthChanged(double from, double to) {}
@override
void flexGrowChanged(double from, double to) {}
@override
void flexShrinkChanged(double from, double to) {}
@override
void aspectRatioChanged(double from, double to) {}
@override
void marginBottomChanged(double from, double to) {}
@override
void marginLeftChanged(double from, double to) {}
@override
void marginRightChanged(double from, double to) {}
@override
void marginTopChanged(double from, double to) {}
@override
void paddingBottomChanged(double from, double to) {}
@override
void paddingLeftChanged(double from, double to) {}
@override
void paddingRightChanged(double from, double to) {}
@override
void paddingTopChanged(double from, double to) {}
@override
void insetBottomChanged(double from, double to) {}
@override
void insetLeftChanged(double from, double to) {}
@override
void insetRightChanged(double from, double to) {}
@override
void insetTopChanged(double from, double to) {}
@override
void gridRowStartChanged(int from, int to) {}
@override
void gridRowEndChanged(int from, int to) {}
@override
void gridColumnStartChanged(int from, int to) {}
@override
void gridColumnEndChanged(int from, int to) {}
void styleIdChanged(int from, int to) {
style = context.resolve(to);
markLayoutNodeDirty();
}
@override
void update(int dirt) {
@ -167,8 +74,175 @@ class LayoutComponent extends LayoutComponentBase {
}
}
final Offset _layoutLocation = Offset.zero;
final Size _layoutSize = Size.zero;
void syncStyle() {
if (_style == null) {
return;
}
_syncStyle(_style!);
}
void _syncStyle(LayoutComponentStyle style) {
bool setIntrinsicWidth = false;
bool setIntrinsicHeight = false;
if (style.intrinsicallySized &&
(style.widthUnits == LayoutUnit.auto ||
style.heightUnits == LayoutUnit.auto)) {
bool foundIntrinsicSize = false;
Size intrinsicSize = Size.zero;
forEachChild((child) {
if (child is LayoutComponent) {
return false;
}
if (child is Sizable) {
var minSize = Size(
style.minWidthUnits == LayoutUnit.point ? style.minWidth : 0,
style.minHeightUnits == LayoutUnit.point ? style.minHeight : 0,
);
var maxSize = Size(
style.maxWidthUnits == LayoutUnit.point
? style.maxWidth
: double.infinity,
style.maxHeightUnits == LayoutUnit.point
? style.maxHeight
: double.infinity,
);
var size = (child as Sizable).computeIntrinsicSize(minSize, maxSize);
intrinsicSize = Size(max(intrinsicSize.width, size.width),
max(intrinsicSize.height, size.height));
foundIntrinsicSize = true;
}
return true;
});
if (foundIntrinsicSize) {
if (style.widthUnits == LayoutUnit.auto) {
setIntrinsicWidth = true;
layoutStyle.setDimension(LayoutDimension.width,
LayoutValue(unit: LayoutUnit.point, value: intrinsicSize.width));
}
if (style.heightUnits == LayoutUnit.auto) {
setIntrinsicHeight = true;
layoutStyle.setDimension(LayoutDimension.height,
LayoutValue(unit: LayoutUnit.point, value: intrinsicSize.height));
}
}
}
if (!setIntrinsicWidth) {
layoutStyle.setDimension(LayoutDimension.width,
LayoutValue(unit: style.widthUnits, value: width));
}
if (!setIntrinsicHeight) {
layoutStyle.setDimension(LayoutDimension.height,
LayoutValue(unit: style.heightUnits, value: height));
}
layoutStyle.setMinDimension(LayoutDimension.width,
LayoutValue(unit: style.minWidthUnits, value: style.minWidth));
layoutStyle.setMinDimension(LayoutDimension.height,
LayoutValue(unit: style.minHeightUnits, value: style.minHeight));
layoutStyle.setMaxDimension(LayoutDimension.width,
LayoutValue(unit: style.maxWidthUnits, value: style.maxWidth));
layoutStyle.setMaxDimension(LayoutDimension.height,
LayoutValue(unit: style.maxHeightUnits, value: style.maxHeight));
layoutStyle.setGap(
LayoutGutter.column,
LayoutValue(
unit: style.gapHorizontalUnits, value: style.gapHorizontal));
layoutStyle.setGap(LayoutGutter.row,
LayoutValue(unit: style.gapVerticalUnits, value: style.gapVertical));
layoutStyle.setBorder(LayoutEdge.left,
LayoutValue(unit: style.borderLeftUnits, value: style.borderLeft));
layoutStyle.setBorder(LayoutEdge.top,
LayoutValue(unit: style.borderTopUnits, value: style.borderTop));
layoutStyle.setBorder(LayoutEdge.right,
LayoutValue(unit: style.borderRightUnits, value: style.borderRight));
layoutStyle.setBorder(LayoutEdge.bottom,
LayoutValue(unit: style.borderBottomUnits, value: style.borderBottom));
layoutStyle.setMargin(LayoutEdge.left,
LayoutValue(unit: style.marginLeftUnits, value: style.marginLeft));
layoutStyle.setMargin(LayoutEdge.top,
LayoutValue(unit: style.marginTopUnits, value: style.marginTop));
layoutStyle.setMargin(LayoutEdge.right,
LayoutValue(unit: style.marginRightUnits, value: style.marginRight));
layoutStyle.setMargin(LayoutEdge.bottom,
LayoutValue(unit: style.marginBottomUnits, value: style.marginBottom));
layoutStyle.setPadding(LayoutEdge.left,
LayoutValue(unit: style.paddingLeftUnits, value: style.paddingLeft));
layoutStyle.setPadding(LayoutEdge.top,
LayoutValue(unit: style.paddingTopUnits, value: style.paddingTop));
layoutStyle.setPadding(LayoutEdge.right,
LayoutValue(unit: style.paddingRightUnits, value: style.paddingRight));
layoutStyle.setPadding(
LayoutEdge.bottom,
LayoutValue(
unit: style.paddingBottomUnits, value: style.paddingBottom));
layoutStyle.setPosition(LayoutEdge.left,
LayoutValue(unit: style.positionLeftUnits, value: style.positionLeft));
layoutStyle.setPosition(LayoutEdge.top,
LayoutValue(unit: style.positionTopUnits, value: style.positionTop));
layoutStyle.setPosition(
LayoutEdge.right,
LayoutValue(
unit: style.positionRightUnits, value: style.positionRight));
layoutStyle.setPosition(
LayoutEdge.bottom,
LayoutValue(
unit: style.positionBottomUnits, value: style.positionBottom));
layoutStyle.display = style.display;
layoutStyle.positionType = style.positionType;
layoutStyle.flex = style.flex;
layoutStyle.flexGrow = style.flexGrow;
layoutStyle.flexShrink = style.flexShrink;
//layoutStyle.flexBasis = style.flexBasis;
layoutStyle.flexDirection = style.flexDirection;
layoutStyle.flexWrap = style.flexWrap;
layoutStyle.alignItems = style.alignItems;
layoutStyle.alignContent = style.alignContent;
layoutStyle.alignSelf = style.alignSelf;
layoutStyle.justifyContent = style.justifyContent;
layoutNode.setStyle(layoutStyle);
}
void syncLayoutChildren() {
final layoutChildren = children.whereType<LayoutComponent>();
layoutNode.clearChildren();
for (var i = 0; i < layoutChildren.length; i++) {
layoutNode.insertChild(layoutChildren.elementAt(i).layoutNode, i);
}
}
@override
void onAdded() {
super.onAdded();
syncLayoutChildren();
}
@override
void onAddedDirty() {
super.onAddedDirty();
style = context.resolve(styleId);
}
void createLayoutStyle() {
var newStyle = LayoutComponentStyle();
context.addObject(newStyle);
style = newStyle;
}
void setupStyle(LayoutComponentStyle style) {
appendChild(style);
style.valueChanged.addListener(styleValueChanged);
}
Offset _layoutLocation = Offset.zero;
Size _layoutSize = Size.zero;
AABB get localBounds {
return AABB.fromValues(
@ -198,6 +272,37 @@ class LayoutComponent extends LayoutComponentBase {
});
}
void updateLayoutBounds() {
final layout = layoutNode.layout;
if (_layoutLocation.dx != layout.left ||
_layoutLocation.dy != layout.top ||
_layoutSize.width != layout.width ||
_layoutSize.height != layout.height) {
_layoutLocation = Offset(layout.left, layout.top);
_layoutSize = Size(layout.width, layout.height);
propagateSize();
markWorldTransformDirty();
}
}
void styleValueChanged() {
markLayoutNodeDirty();
}
void _removeLayoutNode() {
var parent = this.parent;
if (parent is LayoutComponent) {
parent.markLayoutNodeDirty();
}
}
@override
void onRemoved() {
_style?.valueChanged.removeListener(styleValueChanged);
_removeLayoutNode();
super.onRemoved();
}
@override
void buildDependencies() {
super.buildDependencies();

View File

@ -23,6 +23,8 @@ import 'package:rive/src/rive_core/animation/state_machine_listener.dart';
import 'package:rive/src/rive_core/animation/state_machine_trigger.dart';
import 'package:rive/src/rive_core/animation/state_transition.dart';
import 'package:rive/src/rive_core/artboard.dart';
import 'package:rive/src/rive_core/audio_event.dart';
import 'package:rive/src/rive_core/audio_player.dart';
import 'package:rive/src/rive_core/component.dart';
import 'package:rive/src/rive_core/drawable.dart';
import 'package:rive/src/rive_core/event.dart';
@ -118,12 +120,6 @@ class LayerController {
_transition!.duration != 0 &&
_mix != 1;
bool get isTransitionEnded =>
_transition != null &&
_stateFrom != null &&
_transition!.duration != 0 &&
_mix == 1;
void _updateMix(double elapsedSeconds) {
var transition = _transition;
if (transition != null && _stateFrom != null && transition.duration != 0) {
@ -172,12 +168,8 @@ class LayerController {
_stateFrom!.advance(elapsedSeconds, controller);
}
}
_apply(core);
// When we exit a transition we want the currentState to apply its changes
// before moving to the next state
if (isTransitionEnded) {
_apply(core);
}
for (int i = 0; updateState(i != 0); i++) {
_apply(core);
@ -190,8 +182,6 @@ class LayerController {
}
}
_apply(core);
// give the current state the oportunity to clear spilled time, so that we
// do not carry this over into another iteration.
_currentState?.clearSpilledTime();
@ -298,6 +288,7 @@ class StateMachineController extends RiveAnimationController<CoreContext>
OnInputValueChange? onInputValueChange;
final _eventListeners = <OnEvent>{};
AudioPlayer? _audioPlayer;
List<Event> get reportedEvents => _reportedEvents;
@ -437,6 +428,9 @@ class StateMachineController extends RiveAnimationController<CoreContext>
void dispose() {
_clearLayerControllers();
super.dispose();
_audioPlayer?.dispose();
_audioPlayer = null;
}
@protected
@ -538,10 +532,17 @@ class StateMachineController extends RiveAnimationController<CoreContext>
}
});
_eventListeners.toList().forEach((listener) {
for (final event in events) {
listener(RiveEvent.fromCoreEvent(event));
var riveEvents = <RiveEvent>[];
for (final event in events) {
if (event is AudioEvent) {
_audioPlayer ??= AudioPlayer.make();
event.play(_audioPlayer!);
}
riveEvents.add(RiveEvent.fromCoreEvent(event));
}
_eventListeners.toList().forEach((listener) {
riveEvents.forEach(listener);
});
}
}

View File

@ -462,7 +462,8 @@ class Text extends TextBase with TextStyleContainer implements Sizable {
var run = glyphInfo.run;
var font = run.font;
var path = font.getUiPath(run.glyphIdAt(glyphInfo.index));
final glyphId = run.glyphIdAt(glyphInfo.index);
var path = font.getUiPath(glyphId);
late Float64List pathTransform;
if (haveModifiers) {
@ -546,6 +547,7 @@ class Text extends TextBase with TextStyleContainer implements Sizable {
if (sendToLayout) {
for (ContainerComponent? p = parent; p != null; p = p.parent) {
if (p is LayoutComponent) {
p.markLayoutNodeDirty();
// break;
}
}
@ -656,7 +658,6 @@ class Text extends TextBase with TextStyleContainer implements Sizable {
super.update(dirt);
bool rebuildRenderStyles =
_computeShapeWhenNecessary(dirt) || (dirt & ComponentDirt.paint != 0);
// Could optimize this to do what the C++ runtime does by propagating
// opacity to the styles instead of rebuilding render styles.
if (dirt & ComponentDirt.worldTransform != 0) {

View File

@ -29,6 +29,7 @@ import 'package:rive/src/rive_core/animation/state_machine_layer_component.dart'
import 'package:rive/src/rive_core/animation/state_machine_listener.dart';
import 'package:rive/src/rive_core/animation/state_transition.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';
import 'package:rive/src/rive_core/assets/image_asset.dart';
import 'package:rive/src/rive_core/backboard.dart';
@ -239,6 +240,7 @@ class RiveFile {
stackType = StateTransitionBase.typeKey;
break;
}
case AudioAssetBase.typeKey:
case ImageAssetBase.typeKey:
case FontAssetBase.typeKey:
// all these stack objects are resolvers. they get resolved.