fix reset form
This commit is contained in:
parent
fb137ef4f3
commit
4f35d67b02
|
@ -12,6 +12,7 @@ import '/custom_code/actions/index.dart' as actions;
|
||||||
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
late final TabController tabBarController;
|
late final TabController tabBarController;
|
||||||
VoidCallback? onUpdatePet;
|
VoidCallback? onUpdatePet;
|
||||||
|
VoidCallback? onRegisterPet;
|
||||||
|
|
||||||
ApiCallResponse? petsResponse;
|
ApiCallResponse? petsResponse;
|
||||||
int? petId;
|
int? petId;
|
||||||
|
@ -209,6 +210,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
ptText: 'Pet atualizado com sucesso',
|
ptText: 'Pet atualizado com sucesso',
|
||||||
));
|
));
|
||||||
clearFields();
|
clearFields();
|
||||||
|
onUpdatePet?.call();
|
||||||
switchTab(1);
|
switchTab(1);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
log(error.toString());
|
log(error.toString());
|
||||||
|
@ -246,7 +248,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
ptText: 'Pet cadastrado com sucesso',
|
ptText: 'Pet cadastrado com sucesso',
|
||||||
));
|
));
|
||||||
clearFields();
|
clearFields();
|
||||||
onUpdatePet?.call();
|
onRegisterPet?.call();
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
DialogUtil.errorDefault(buildContext!);
|
DialogUtil.errorDefault(buildContext!);
|
||||||
});
|
});
|
||||||
|
@ -255,7 +257,6 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
void switchTab(int index) {
|
void switchTab(int index) {
|
||||||
tabBarController.animateTo(index);
|
tabBarController.animateTo(index);
|
||||||
if (index == 1) handleEditingChanged(false);
|
if (index == 1) handleEditingChanged(false);
|
||||||
onUpdatePet?.call();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUploadComplete(FFUploadedFile uploadedFile) {
|
void handleUploadComplete(FFUploadedFile uploadedFile) {
|
||||||
|
|
|
@ -60,6 +60,11 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
_model.tabBarController = TabController(length: 2, vsync: this);
|
_model.tabBarController = TabController(length: 2, vsync: this);
|
||||||
_model.onUpdatePet = () {
|
_model.onUpdatePet = () {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
Form.of(context).reset();
|
||||||
|
};
|
||||||
|
_model.onRegisterPet = () {
|
||||||
|
setState(() {});
|
||||||
|
Form.of(context).reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
widget.pet != null ? _model.isEditing = true : _model.isEditing = false;
|
widget.pet != null ? _model.isEditing = true : _model.isEditing = false;
|
||||||
|
|
Loading…
Reference in New Issue