diff --git a/lib/components/atomic_components/shared_components_atoms/custom_input.dart b/lib/components/atomic_components/shared_components_atoms/custom_input.dart index d7b724d6..608f60af 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_input.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_input.dart @@ -60,11 +60,16 @@ class _CustomInputUtilState extends State { validator: widget.validator, autofocus: widget.autoFocus, focusNode: widget.focusNode, - onChanged: (_) => EasyDebounce.debounce( - '${widget.controller}', - const Duration(milliseconds: 500), - () => setState(() {}), - ), + onChanged: (value) { + EasyDebounce.debounce( + '${widget.controller}', + const Duration(milliseconds: 500), + () => setState(() {}), + ); + if (widget.onChanged != null) { + widget.onChanged!(value); // Chamar o callback + } + }, textInputAction: widget.textInputAction, obscureText: false, decoration: InputDecoration( diff --git a/lib/pages/pets_page/pets_page_model.dart b/lib/pages/pets_page/pets_page_model.dart index 2733e2f2..d29b1b7a 100644 --- a/lib/pages/pets_page/pets_page_model.dart +++ b/lib/pages/pets_page/pets_page_model.dart @@ -201,7 +201,8 @@ class PetsPageModel extends FlutterFlowModel { size: dropDownValue2!, ) .then((response) { - if (response.jsonBody['error'] == true) { + if (response.jsonBody['error'] == true || + isFormValid(buildContext!) == false) { DialogUtil.error(buildContext!, jsonDecode(response.jsonBody['error_msg'])[0]['message']); } diff --git a/lib/pages/pets_page/pets_page_widget.dart b/lib/pages/pets_page/pets_page_widget.dart index 963faa14..05cec7dc 100644 --- a/lib/pages/pets_page/pets_page_widget.dart +++ b/lib/pages/pets_page/pets_page_widget.dart @@ -233,6 +233,7 @@ class _PetsPageWidgetState extends State .getVariableText(ptText: 'Nome', enText: 'Name'), suffixIcon: Symbols.format_color_text, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), Padding( @@ -249,6 +250,7 @@ class _PetsPageWidgetState extends State enText: 'e.g. Dog, Cat, Parrot'), suffixIcon: Symbols.sound_detection_dog_barking, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), ), @@ -266,6 +268,7 @@ class _PetsPageWidgetState extends State enText: 'e.g. Labrador, Poodle, Siamese, Persian'), suffixIcon: Icons.pets_outlined, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), ), @@ -283,6 +286,7 @@ class _PetsPageWidgetState extends State enText: 'e.g. Black, Yellow, White'), suffixIcon: Symbols.palette, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), ), @@ -620,6 +624,7 @@ class _PetsPageWidgetState extends State enText: 'Write your observations here...'), suffixIcon: Icons.text_fields, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 250, ), Padding( @@ -691,6 +696,7 @@ class _PetsPageWidgetState extends State .getVariableText(ptText: 'Nome', enText: 'Name'), suffixIcon: Symbols.format_color_text, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), Padding( @@ -707,6 +713,7 @@ class _PetsPageWidgetState extends State enText: 'e.g. Dog, Cat, Parrot'), suffixIcon: Symbols.sound_detection_dog_barking, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), ), @@ -724,6 +731,7 @@ class _PetsPageWidgetState extends State enText: 'e.g. Labrador, Poodle, Siamese, Persian'), suffixIcon: Icons.pets_outlined, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), ), @@ -741,6 +749,7 @@ class _PetsPageWidgetState extends State enText: 'e.g. Black, Yellow, White'), suffixIcon: Symbols.palette, haveMaxLength: true, + onChanged: (value) => setState(() {}), maxLength: 80, ), ), @@ -1081,6 +1090,7 @@ class _PetsPageWidgetState extends State suffixIcon: Icons.text_fields, haveMaxLength: true, maxLength: 250, + onChanged: (value) => setState(() {}), ), Padding( padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),