Merge pull request #69 from FRE-Informatica/fix/fd-972
FIX/FD-972 - Falha na validação de gênero e porte no cadastro de pets
This commit is contained in:
commit
03b9e1acc2
|
@ -45,6 +45,8 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
FFUploadedFile? uploadedTempFile;
|
FFUploadedFile? uploadedTempFile;
|
||||||
String? imgBase64;
|
String? imgBase64;
|
||||||
|
|
||||||
|
late String defaultDropDownText = '';
|
||||||
|
|
||||||
String? dropDownValue1;
|
String? dropDownValue1;
|
||||||
FormFieldController<String>? dropDownValueController1;
|
FormFieldController<String>? dropDownValueController1;
|
||||||
|
|
||||||
|
@ -103,6 +105,13 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
String? Function(BuildContext, String?)? textControllerObservationValidator;
|
String? Function(BuildContext, String?)? textControllerObservationValidator;
|
||||||
|
|
||||||
Future<void> initAsync() async {
|
Future<void> initAsync() async {
|
||||||
|
defaultDropDownText = FFLocalizations.of(buildContext!).getVariableText(
|
||||||
|
enText: 'Select an option',
|
||||||
|
ptText: 'Selecione uma opção',
|
||||||
|
);
|
||||||
|
dropDownValueController1 = FormFieldController<String>(dropDownValue1 ??= defaultDropDownText);
|
||||||
|
dropDownValueController2 = FormFieldController<String>(dropDownValue2 ??= defaultDropDownText);
|
||||||
|
|
||||||
devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||||
userUUID = (await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
userUUID = (await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||||
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||||
|
@ -136,10 +145,6 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
textFieldFocusObservation = FocusNode();
|
textFieldFocusObservation = FocusNode();
|
||||||
textControllerObservation = TextEditingController();
|
textControllerObservation = TextEditingController();
|
||||||
|
|
||||||
dropDownValueController1 = FormFieldController<String>(dropDownValue1 ??= 'Selecione uma opção');
|
|
||||||
|
|
||||||
dropDownValueController2 = FormFieldController<String>(dropDownValue2 ??= 'Selecione uma opção');
|
|
||||||
|
|
||||||
initAsync();
|
initAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,12 +235,25 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropDownValue1 == null || dropDownValue1!.isEmpty || dropDownValue1 == '') {
|
if (dropDownValueController1!.value == defaultDropDownText ||
|
||||||
|
dropDownValueController1!.value == '' ||
|
||||||
|
dropDownValueController1!.value == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dropDownValue2 == null || dropDownValue2!.isEmpty || dropDownValue2 == '') {
|
if (dropDownValueController2!.value == defaultDropDownText ||
|
||||||
|
dropDownValueController2!.value == '' ||
|
||||||
|
dropDownValueController2!.value == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dropDownValue1 == 'Selecione uma opção' || dropDownValue1 == null || dropDownValue1 == '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dropDownValue2 == 'Selecione uma opção' || dropDownValue2 == null || dropDownValue2 == '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +276,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
if (response.jsonBody['error'] == false) {
|
||||||
DialogUtil.success(
|
await DialogUtil.success(
|
||||||
buildContext!,
|
buildContext!,
|
||||||
FFLocalizations.of(buildContext!).getVariableText(
|
FFLocalizations.of(buildContext!).getVariableText(
|
||||||
enText: 'Pet successfully updated',
|
enText: 'Pet successfully updated',
|
||||||
|
@ -279,7 +297,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
ptText: 'Falha ao atualizar o pet',
|
ptText: 'Falha ao atualizar o pet',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
DialogUtil.error(buildContext!, errorMessage);
|
await DialogUtil.error(buildContext!, errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +317,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
if (response.jsonBody['error'] == false) {
|
||||||
DialogUtil.success(
|
await DialogUtil.success(
|
||||||
buildContext!,
|
buildContext!,
|
||||||
FFLocalizations.of(buildContext!).getVariableText(
|
FFLocalizations.of(buildContext!).getVariableText(
|
||||||
enText: 'Pet successfully registered',
|
enText: 'Pet successfully registered',
|
||||||
|
@ -311,15 +329,16 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
try {
|
try {
|
||||||
errorMessage = jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString();
|
errorMessage = jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString();
|
||||||
|
await DialogUtil.error(buildContext!, errorMessage);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (response.jsonBody['error_msg'] == "Limite de Cadastro de Pet Atingido.") {
|
if (response.jsonBody['error_msg'] == "Limite de Cadastro de Pet Atingido.") {
|
||||||
errorMessage = FFLocalizations.of(buildContext!).getVariableText(
|
errorMessage = FFLocalizations.of(buildContext!).getVariableText(
|
||||||
enText: 'Pet registration limit reached',
|
enText: 'Pet registration limit reached',
|
||||||
ptText: 'Limite de cadastro de pets atingido',
|
ptText: 'Limite de cadastro de pets atingido',
|
||||||
);
|
);
|
||||||
DialogUtil.error(buildContext!, errorMessage);
|
await DialogUtil.error(buildContext!, errorMessage);
|
||||||
} else {
|
} else {
|
||||||
DialogUtil.errorDefault(buildContext!);
|
await DialogUtil.errorDefault(buildContext!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,10 +378,8 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
// dropDownValue1 = '';
|
// dropDownValue1 = '';
|
||||||
// dropDownValue2 = '';
|
// dropDownValue2 = '';
|
||||||
|
|
||||||
// dropDownValueController1 =
|
// dropDownValueController1 = FormFieldController<String>('Selecione uma opção');
|
||||||
// FormFieldController<String>('Selecione uma opção');
|
// dropDownValueController2 = FormFieldController<String>('Selecione uma opção');
|
||||||
// dropDownValueController2 =
|
|
||||||
// FormFieldController<String>('Selecione uma opção');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildPetDetails({
|
Widget buildPetDetails({
|
||||||
|
|
Loading…
Reference in New Issue