Skip to content

Commit

Permalink
feat(app) add virtual_config to popup
Browse files Browse the repository at this point in the history
  • Loading branch information
helderbetiol committed Jun 20, 2024
1 parent 38ce20b commit 4341d9d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion APP/lib/widgets/select_objects/object_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -801,13 +801,26 @@ class _ObjectPopupState extends State<ObjectPopup> {
tipStr: examplesAttrs[_objCategory]
?[attributes[index].replaceFirst(starSymbol, "")] ??
"",
extraValidationFn:
attributes[index].replaceFirst(starSymbol, "") ==
"virtual_config"
? (newValue) {
try {
json.decode(newValue);
} on Exception {
return 'object format: {"type":"storage"}';
}
}
: null,
save: (newValue) {
var attrKey =
attributes[index].replaceFirst(starSymbol, "");
if (newValue != null && newValue.isNotEmpty) {
// check type
var numValue = num.tryParse(newValue);
if (numValue != null) {
if (attrKey == "virtual_config") {
objDataAttrs[attrKey] = json.decode(newValue);
} else if (numValue != null) {
// is number
objDataAttrs[attrKey] = numValue.toDouble();
} else if (newValue.length >= 2 &&
Expand Down

0 comments on commit 4341d9d

Please sign in to comment.