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

View File

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