@@ -11,7 +11,7 @@ part 'variance_node.g.dart';
1111/// and switch them based on certain conditions. For example, it can be used to
1212/// create success and error states of a widget.
1313@JsonSerializable ()
14- class VarianceNode extends SinglePlaceholderNode {
14+ class VarianceNode extends SinglePlaceholderNode with CustomPropertiesMixin {
1515 @override
1616 final String type = 'variance' ;
1717
@@ -52,6 +52,10 @@ class VarianceNode extends SinglePlaceholderNode {
5252 /// All variants of the node.
5353 List <Variant > variants;
5454
55+ /// Holds configurable properties of the variance node.
56+ @override
57+ covariant VarianceProperties properties;
58+
5559 /// Creates a [VarianceNode] instance with the given data.
5660 VarianceNode ({
5761 bool ? value,
@@ -77,8 +81,13 @@ class VarianceNode extends SinglePlaceholderNode {
7781 super .parentID,
7882 super .reactions,
7983 String ? currentVariantId,
84+ super .maxAllowedSize,
85+ super .variables,
86+ super .multipleVariables,
87+ VarianceProperties ? properties,
8088 }) : assert (variants.isNotEmpty),
8189 currentVariantId = currentVariantId ?? variants[0 ].id,
90+ properties = properties ?? const VarianceProperties (),
8291 super (
8392 children: [],
8493 allowedTypes: [],
@@ -93,6 +102,8 @@ class VarianceNode extends SinglePlaceholderNode {
93102 List <Object ?> get props => [
94103 ...super .props,
95104 variants,
105+ properties,
106+ currentVariantId,
96107 ];
97108
98109 /// Creates a [VarianceNode] instance from a JSON object.
@@ -130,3 +141,20 @@ class Variant with SerializableMixin, EquatableMixin {
130141 /// Creates a [Variant] instance from a JSON object.
131142 factory Variant .fromJson (Map json) => _$VariantFromJson (json);
132143}
144+
145+ /// [VarianceProperties] is used to store custom properties of a [VarianceNode] .
146+ @JsonSerializable ()
147+ class VarianceProperties extends CustomProperties {
148+ /// Creates a [VarianceProperties] instance with the given data.
149+ const VarianceProperties ();
150+
151+ @override
152+ Map <String , dynamic > toJson () => _$VariancePropertiesToJson (this );
153+
154+ /// Creates a [VarianceProperties] instance from a JSON object.
155+ factory VarianceProperties .fromJson (Map <String , dynamic > json) =>
156+ _$VariancePropertiesFromJson (json);
157+
158+ @override
159+ List <Object ?> get props => [];
160+ }
0 commit comments