Skip to content

Commit eb823bd

Browse files
committed
Conditions #45
- Refactor node.variables and node.multipleVariables to use variablePaths and names instead of ids. - Add variable support for progress bar value. - Refactor RegexTextEditingController to use RegExpMatch instead of Match. - Improve support for data and variable path substitution. - Add support data path binding on properties.
1 parent 7014d50 commit eb823bd

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

lib/src/api/mixins.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,10 @@ mixin VariablePropertiesMixin {
813813
this.multipleVariables = multipleVariables ?? {};
814814
}
815815

816-
/// Whether a variable with given [id] or name is used by this node.
817-
bool usesVariable(String id) =>
818-
variables.values.contains(id) ||
819-
multipleVariables.values.any((e) => e.contains(id));
820-
821816
/// Replace variable with [oldName] to [newName].
822-
void updateVariableName({required String oldName, required String newName}) {}
817+
void updateVariableName({required String oldName, required String newName}) {
818+
// TODO: implement updateVariableName.
819+
}
823820
}
824821

825822
/// A mixin that allows to define properties of a node that can be set via an

lib/src/api/models/variables_model.dart

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ enum VariableType {
2020
boolean,
2121

2222
/// List type. Represents a list of values.
23-
list;
23+
list,
24+
25+
/// Map type. Represents a map.
26+
map;
2427

2528
/// Returns a string representation of the variable type.
2629
String get label {
@@ -35,6 +38,8 @@ enum VariableType {
3538
return 'Boolean';
3639
case VariableType.list:
3740
return 'List';
41+
case VariableType.map:
42+
return 'Map';
3843
}
3944
}
4045
}
@@ -57,11 +62,12 @@ class VariableData
5762
final String value;
5863

5964
@JsonKey(unknownEnumValue: VariableType.text)
65+
6066
/// Type of the variable. This is used to determine how to parse the value.
6167
final VariableType type;
6268

6369
/// Creates a new [VariableData].
64-
VariableData({
70+
const VariableData({
6571
required this.id,
6672
required this.name,
6773
this.value = '',
@@ -265,3 +271,13 @@ List<CanvasVariables> canvasVariablesFromJson(Map<String, dynamic> json) {
265271
CanvasVariables.fromJson({'id': entry.key, 'variables': entry.value}),
266272
];
267273
}
274+
275+
/// A variable class that represents creation of a variable from given name.
276+
class PredefinedVariableData extends VariableData {
277+
/// Creates a new [PredefinedVariableData].
278+
PredefinedVariableData({
279+
required super.name,
280+
super.value = '',
281+
super.type = VariableType.text,
282+
}) : super(id: generateId());
283+
}

lib/src/api/models/variables_model.g.dart

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

0 commit comments

Comments
 (0)