Added path field

This commit is contained in:
Juan Gilsanz Polo
2024-02-26 15:47:41 +01:00
parent a82dbea166
commit fa0441a0e4
8 changed files with 53 additions and 8 deletions

View File

@@ -53,8 +53,8 @@ class Connect extends _$Connect {
ref.notifyListeners();
}
void validatePort(value) {
if (value != null && value != '') {
void validatePort(String value) {
if (value != '') {
if (int.tryParse(value) != null && int.parse(value) <= 65535) {
state.portError = null;
} else {
@@ -65,6 +65,20 @@ class Connect extends _$Connect {
ref.notifyListeners();
}
void validatePath(String value) {
if (value == "") {
state.pathError = null;
} else {
if (Regexps.path.hasMatch(value) == true) {
state.pathError = null;
} else {
state.pathError = t.onboarding.invalidPath;
}
}
state.validValues = validValues();
ref.notifyListeners();
}
void validateToken(String value) {
if (value != "") {
state.tokenError = null;
@@ -79,7 +93,9 @@ class Connect extends _$Connect {
return state.tokenController.text != "" &&
state.tokenError == null &&
state.ipDomainController.text != "" &&
state.ipDomainError == null;
state.ipDomainError == null &&
state.pathError == null &&
state.portError == null;
}
}