skip to Main Content

how to know when the user completes the text field flutter,
for example, i need to apply a logic, When user complete the textformfeild,I tried oneditingCompleted method, but its not working, so please share the how do this one

2

Answers


  1. It depends on how you define "COMPLETE". What is "complete"? Is it when user press Enter? Is it when some text exists on the form? If I want to write Harry Potter in that form, what is the completion? Is it when Voldemort dies, or Severus Albus Potter gets on the train? Please provide more information.

    In case of user press enter is defined as completion, use can use onSubmit. You can combine it with validator to ensure user types something there.

    Login or Signup to reply.
  2. You can detect when a user completes entering text in a TextFormField widget by utilizing the onFieldSubmitted property.

    TextEditingController _textEditingController = TextEditingController();
    
        TextFormField(
          controller: _textEditingController,
          onFieldSubmitted: (value) {
            // Called when the user submits the form field
            print('User completed entering text: $value');
            // Perform any desired actions here
          },
        );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search