Skip to content

Commit a9e782b

Browse files
committed
Refactor VariablePropertiesMixin.
1 parent 5d28f14 commit a9e782b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+344
-190
lines changed

lib/src/api/mixins.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'package:json_annotation/json_annotation.dart';
66

7-
import 'models/condition.dart';
87
import 'models/models.dart';
98
import 'nodes/nodes.dart';
109

@@ -794,7 +793,7 @@ mixin ScalableMixin on BaseNode {
794793

795794
/// A mixin that allows a node to store variables for its properties so that
796795
/// value of those properties can be retrieved from those variables if present.
797-
mixin VariablePropertiesMixin on BaseNode {
796+
mixin VariablePropertiesMixin {
798797
/// property_name -> variable_name
799798
@JsonKey(defaultValue: {})
800799
Map<String, String> variables = {};
@@ -1038,6 +1037,8 @@ mixin SerializableMixin {
10381037
Map toJson();
10391038
}
10401039

1040+
/// A mixin that adds the ability to add conditions to a node.
10411041
mixin ConditionsMixin {
1042+
/// List of conditions that are applied to this node.
10421043
List<BaseCondition> conditions = [];
10431044
}

lib/src/api/nodes/accordion_node.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class AccordionNode extends SceneNode
2020
ChildrenMixin,
2121
RowColumnMixin,
2222
CustomPropertiesMixin,
23-
VariablePropertiesMixin,
2423
IsolatedMixin {
2524
@override
2625
final String type = 'accordion';
@@ -54,6 +53,8 @@ class AccordionNode extends SceneNode
5453
super.reactions,
5554
required List<String> children,
5655
this.isExpanded = true,
56+
super.variables,
57+
super.multipleVariables,
5758
}) {
5859
setChildrenMixin(children: children);
5960
setRowColumnMixin(

lib/src/api/nodes/accordion_node.g.dart

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/app_bar_node.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const double kAppBarDefaultHeight = 56;
2121
/// in Flutter for more details.
2222
@JsonSerializable()
2323
class AppBarNode extends SceneNode
24-
with CustomPropertiesMixin, VariablePropertiesMixin, ParentReactionMixin {
24+
with CustomPropertiesMixin, ParentReactionMixin {
2525
@override
2626
final String type = 'appBar';
2727

@@ -48,6 +48,8 @@ class AppBarNode extends SceneNode
4848
super.edgePins,
4949
super.aspectRatioLock,
5050
super.positioningMode,
51+
super.variables,
52+
super.multipleVariables,
5153
required this.properties,
5254
});
5355

lib/src/api/nodes/app_bar_node.g.dart

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/auto_placeholder_node.g.dart

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/base_node.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ bool isTestLayout = false;
2828
/// If you wish to update the values of a node, it is highly recommended you
2929
/// use the [update] extension method or the [updateNode] method inside the
3030
/// [NodeProcessor] class.
31-
abstract class BaseNode with SerializableMixin, EquatableMixin {
31+
abstract class BaseNode
32+
with SerializableMixin, EquatableMixin, VariablePropertiesMixin {
3233
/// [type] is a string representation for the type of this node. It is a
3334
/// unique key that this node class uses for static registration. It is
3435
/// usually the lowerCamelCase of the class' name. Overriding [type] is
@@ -383,6 +384,8 @@ abstract class BaseNode with SerializableMixin, EquatableMixin {
383384
this.parentID = '',
384385
this.widthFactor,
385386
this.heightFactor,
387+
Map<String, String>? variables,
388+
Map<String, List<String>>? multipleVariables,
386389
}) : _basicBoxLocal = basicBoxLocal,
387390
_rotationDegrees = rotationDegrees,
388391
globalRotationDegrees = rotationDegrees,
@@ -409,6 +412,8 @@ abstract class BaseNode with SerializableMixin, EquatableMixin {
409412

410413
NodeProcessor._computeInnerBoxLocal(this);
411414
NodeProcessor._computeInnerBoxGlobal(this);
415+
setVariablesMixin(
416+
variables: variables, multipleVariables: multipleVariables);
412417
}
413418

414419
/// The minimum internal size is the size that this node

lib/src/api/nodes/button_node.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ enum ButtonTypeEnum {
6161
/// more details.
6262
@JsonSerializable()
6363
class ButtonNode extends SceneNode
64-
with CustomPropertiesMixin, VariablePropertiesMixin {
64+
with CustomPropertiesMixin {
6565
@override
6666
final String type = 'button';
6767

@@ -127,12 +127,9 @@ class ButtonNode extends SceneNode
127127
super.parentID,
128128
super.positioningMode,
129129
required this.properties,
130-
Map<String, String>? variables,
131-
Map<String, List<String>>? multipleVariables,
132-
}) {
133-
setVariablesMixin(
134-
variables: variables, multipleVariables: multipleVariables);
135-
}
130+
super.variables,
131+
super.multipleVariables,
132+
});
136133

137134
@override
138135
BoxConstraintsModel internalConstraints({

lib/src/api/nodes/button_node.g.dart

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/canvas_node.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class CanvasNode extends ParentNode
1919
RowColumnMixin,
2020
IsolatedMixin,
2121
ScrollableMixin,
22-
CustomPropertiesMixin,
23-
VariablePropertiesMixin {
22+
CustomPropertiesMixin {
2423
@override
2524
final String type = 'canvas';
2625

0 commit comments

Comments
 (0)