|
| 1 | +import 'input.dart'; |
| 2 | +import 'output.dart'; |
| 3 | + |
| 4 | +class WorkflowNode { |
| 5 | + final int id; |
| 6 | + final String type; |
| 7 | + final List<double> position; |
| 8 | + final List<double> size; |
| 9 | + final Map<String, dynamic> flags; |
| 10 | + final int order; |
| 11 | + final int mode; |
| 12 | + final List<WorkflowInput> inputs; |
| 13 | + final List<WorkflowOutput> outputs; |
| 14 | + final Map properties; |
| 15 | + final String? color = null; |
| 16 | + final String? bgcolor = null; |
| 17 | + final List<dynamic>? widgets_values = []; |
| 18 | + |
| 19 | + WorkflowNode( |
| 20 | + this.id, |
| 21 | + this.type, |
| 22 | + this.position, |
| 23 | + this.size, |
| 24 | + this.flags, |
| 25 | + this.order, |
| 26 | + this.mode, |
| 27 | + this.inputs, |
| 28 | + this.outputs, |
| 29 | + this.properties, |
| 30 | + { |
| 31 | + String? color, |
| 32 | + String? bgcolor, |
| 33 | + List<dynamic>? widgets_values |
| 34 | + } |
| 35 | + ); |
| 36 | + |
| 37 | + factory WorkflowNode.fromJSON(Map<String, dynamic> json) { |
| 38 | + int x; |
| 39 | + int y; |
| 40 | + |
| 41 | + final id = json['id'] as int; |
| 42 | + final type = json['type'] as String; |
| 43 | + final pos = json['pos'].map<double>((item) => item as double).toList(); |
| 44 | + final size = json['size'].map<double>((item) => item as double).toList(); |
| 45 | + final flags = json['flags'] as Map<String, dynamic>; |
| 46 | + final order = json['order'] as int; |
| 47 | + final mode = json['mode'] as int; |
| 48 | + final inputs = json['inputs'].map<WorkflowInput>((item) => WorkflowInput(item)).toList(); |
| 49 | + final outputs = json['outputs'].map<WorkflowOutput>((item) => WorkflowOutput(item)).toList(); |
| 50 | + final properties = json['properties'] as Map; |
| 51 | + final color = json['color'] as String?; |
| 52 | + final bgcolor = json['bgcolor'] as String?; |
| 53 | + final widgets_values = json['widgets_values'] as List<dynamic>?; |
| 54 | + |
| 55 | + return WorkflowNode( |
| 56 | + id, |
| 57 | + type, |
| 58 | + pos, |
| 59 | + size, |
| 60 | + flags, |
| 61 | + order, |
| 62 | + mode, |
| 63 | + inputs, |
| 64 | + outputs, |
| 65 | + properties, |
| 66 | + color: color, |
| 67 | + bgcolor: bgcolor, |
| 68 | + widgets_values: widgets_values |
| 69 | + ); |
| 70 | + } |
| 71 | +} |
0 commit comments