Skip to content

Commit 5a493dc

Browse files
committed
Banners #7
1 parent d336caf commit 5a493dc

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

lib/src/api/models/action/set_cloud_storage_action.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.

lib/src/api/models/action/set_storage_action.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.

lib/src/api/models/variables_model.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ enum VariableType {
2828
list,
2929

3030
/// Map type. Represents a map.
31-
map;
31+
map,
32+
33+
/// Image type. Represents an image URL.
34+
image;
3235

3336
/// Returns a string representation of the variable type.
3437
String get label => switch (this) {
@@ -39,6 +42,7 @@ enum VariableType {
3942
VariableType.color => 'Color',
4043
VariableType.list => 'List',
4144
VariableType.map => 'Map',
45+
VariableType.image => 'Image',
4246
};
4347

4448
factory VariableType.fromObjectType(Object obj) {
@@ -76,6 +80,9 @@ enum VariableType {
7680

7781
/// Whether the variable type is [VariableType.text].
7882
bool get isText => this == VariableType.text;
83+
84+
/// Whether the variable type is [VariableType.text].
85+
bool get isImage => this == VariableType.image;
7986
}
8087

8188
/// Store information of a variable. [id] must not be empty when creating a
@@ -156,6 +163,7 @@ class VariableData
156163
/// Returns the value converted to the appropriate type according to [type].
157164
Object? getValue() => switch (type) {
158165
VariableType.text => value.isEmpty ? null : value,
166+
VariableType.image => value.isEmpty ? null : value,
159167
VariableType.integer => num.tryParse(value).toInt(),
160168
VariableType.decimal => num.tryParse(value).toDouble(),
161169
VariableType.boolean => bool.tryParse(value, caseSensitive: false),
@@ -178,6 +186,7 @@ String? sanitizeValueForVariableType(Object? value, VariableType type) {
178186
if (value.toString().contains(variablePathPattern)) return value.toString();
179187
switch (type) {
180188
case VariableType.text:
189+
case VariableType.image:
181190
return value.toString();
182191
case VariableType.integer:
183192
return num.tryParse(value.toString()).toInt()?.toString();

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)