1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] How to reset AutovalidateMode.onUserInteraction for form_builder_validators in...

Discussão em 'Mobile' iniciado por Stack, Novembro 1, 2024 às 20:52.

  1. Stack

    Stack Membro Participativo

    I have made a series of forms using the very helpful package flutter_form_builder. I am using the auto validate property from form_builder_validators set to onUserInteraction so errors will only show after the user has tried to interact at least once.

    autovalidateMode: AutovalidateMode.onUserInteraction,


    I have a button to clear the forms.

    onPressed: () {
    _formKey.currentState?.reset();
    },
    text: 'Clear fields',
    ),


    Everything works perfect. Except, I want onUserInteraction to reset but I can't work out how to set the validator back to its initial state (where the validator assumes the user has not interacted with any forms again). Apart from using Navigator to reload the page, is there a more efficient way of doing this?

    [​IMG]

    Continue reading...

Compartilhe esta Página