continue fix pets

This commit is contained in:
J. A. Messias 2024-09-27 14:37:30 -03:00
parent cb60004b0e
commit bf3b030059
2 changed files with 13 additions and 23 deletions

View File

@ -131,11 +131,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
textControllerColor = TextEditingController();
textFieldFocusData = FocusNode();
textControllerData = TextEditingController(
text: dateTimeFormat(
'dd/MM/yyyy',
DateTime.now(),
));
textControllerData = TextEditingController(text: '');
textFieldFocusObservation = FocusNode();
textControllerObservation = TextEditingController();
@ -183,14 +179,8 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
text: item != null
? item['birthdayDate'] != null
? ValidatorUtil.formatDateTimePicker(item['birthdayDate'])
: dateTimeFormat(
'dd/MM/yyyy',
DateTime.now(),
)
: dateTimeFormat(
'dd/MM/yyyy',
DateTime.now(),
));
: ''
: '');
textFieldFocusData = FocusNode();
@ -270,7 +260,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId';
final response = await PhpGroup.updatePet.call(
petID: petId,
image: imgBase64,
image: img,
birthdayDate: textControllerData!.text,
color: textControllerColor!.text,
breed: textControllerRace!.text,
@ -288,11 +278,11 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
enText: 'Pet successfully updated',
ptText: 'Pet atualizado com sucesso',
),
);
).then((_) async {
CachedNetworkImage.evictFromCache(url);
onUpdatePet?.call();
switchTab(1);
});
onUpdatePet?.call();
} else {
String errorMessage;
try {
@ -368,7 +358,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
clearFields();
}
Future<void> clearFields() async {
void clearFields() async {
uploadedLocalFile = null;
textControllerName = TextEditingController(text: '');

View File

@ -46,13 +46,13 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
_model.updateOnChange = true;
_model.onUpdatePet = () {
safeSetState(() async {
await _model.clearFields();
safeSetState(() {
_model.clearFields();
});
};
_model.onRegisterPet = () {
safeSetState(() async {
await _model.clearFields().then((_) => safeSetState(() {}));
safeSetState(() {
_model.clearFields();
});
};
_model.safeSetState = () {