Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Commit

Permalink
fixes #119, #121
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitbhanushali committed Dec 20, 2021
1 parent b28f5ef commit 7dd8f4c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions lib/widgets/custom_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,25 @@ class CustomFormViewModel extends BaseViewModel {
field.pVisible = 0;
}
} else {
field.pVisible = doc[field.dependsOn] is String
? int.parse(doc[field.dependsOn])
: doc[field.dependsOn];
var dependsOnVal = doc[field.dependsOn];
if (dependsOnVal is String) {
if (dependsOnVal.isEmpty) {
field.pVisible = 0;
} else {
if (dependsOnVal == "1") {
field.pVisible = 1;
} else if (dependsOnVal == "0") {
field.pVisible = 0;
} else {
field.pVisible = 1;
}
}
} else if (doc[field.dependsOn] is List) {
field.pVisible = doc[field.dependsOn].isEmpty ? 0 : 1;
} else {
// always visible if handling of type is missing
field.pVisible = 1;
}
}
}

Expand Down

0 comments on commit 7dd8f4c

Please sign in to comment.