How to handle 'submit' in a flutter web app?

Viewed 57

I am implementing sign-in functionality in my flutter web app.

My widget contains the text field 'Email', text field 'Password', and button 'Sign In'. I want to execute sign-in in two cases: user clicked button 'Sign In' or user pressed 'Enter'.

I invoke sign-in in two handlers:

  • for the button's 'onPressed'
  • for the text fields` onSubmitted.

As a result sign-in happens in three cases: button clicked, user hits 'Enter', and focus change between the text fields.

What is a recommended way to exclude focus change?

0 Answers
Related