Search code examples
flutterdartinputtextfieldtextformfield

Issue with Text-Form-Field in Flutter


I want to change value input without typing. Example, I have two Text-Form-Field then I want when I type 1 in Text-Form-Field #1 so the value display in Text-Form-Field #2 is 2. I want to value change depend on value in other input then display it.

I am trying but not work. So how to solve this problem. Please help me !!!!!!!!!

Update: I solved this problem. Thank for everyone !!!


Solution

  • You can update value of text field 2 in onChanged method of text field 1.

    Example:-

    TextFormField(
                    controller: textController1,
                    onChanged: (String? value){
                      textController2.text="new value";
                    },
                  ),