2

The cursor is continuously moving to front while typing data in text field. Before it is not there but once I wired onChange event, it is happening.

My issue:

Issue with TextField

My code:

 Padding(
        padding: const EdgeInsets.all(8.0),
        child: TextField(
          controller: descriptionController,
          decoration: InputDecoration(
            labelText: 'Any Details',
            hintText: "e.g. Whatever details you want to save",
            labelStyle: textStyle,
            border: OutlineInputBorder(
                borderRadius: BorderRadius.circular(5.0)
            ),
          ),
          keyboardType: TextInputType.text,
          onChanged: (String string){
            setState(() {
              if (string != null){
                coinOrder.description = string;
              }


            });
          },
        ),
      )
uday
  • 569
  • 1
  • 6
  • 16
  • Can this post help ? [https://stackoverflow.com/questions/56851701/how-to-set-cursor-position-at-the-end-of-the-value-in-flutter-in-textfield](https://stackoverflow.com/questions/56851701/how-to-set-cursor-position-at-the-end-of-the-value-in-flutter-in-textfield) – LittleSoap May 07 '21 at 07:03
  • It seems this issue is fixed partially, now after setting the project level sdk, this error is not coming. But, android debug bridge is not working. Can you see this once https://www.youtube.com/watch?v=IyDkHQeQVyA – uday May 07 '21 at 09:54
  • See this post maybe, [https://stackoverflow.com/questions/27301960/errorunable-to-locate-adb-within-sdk-in-android-studio](https://stackoverflow.com/questions/27301960/errorunable-to-locate-adb-within-sdk-in-android-studio) – LittleSoap May 07 '21 at 10:17
  • My TextField issue not fixed yet, sorry for the wrong information as comment earlier, as I typed here by mistake instead of other post. – uday May 07 '21 at 13:06

2 Answers2

0

you can use onFieldSubmitted that will work too enter image description here

0

You can use one string variable to store value so this issue will not accrue. see the below code.

String? details;
Padding(
        padding: const EdgeInsets.all(8.0),
        child: TextField(
          controller: descriptionController,
          decoration: InputDecoration(
            labelText: 'Any Details',
            hintText: "e.g. Whatever details you want to save",
            labelStyle: textStyle,
            border: OutlineInputBorder(
                borderRadius: BorderRadius.circular(5.0)
            ),
          ),
          keyboardType: TextInputType.text,
          onChanged: (String string){
            setState(() {
              if (string != null){
                //coinOrder.description = string;
                details=string;
              }


            });
          },
        ),
      )