首页 > 解决方案 > 如何使用颤动的 onChange 事件修复光标移动?

问题描述

在文本字段中键入数据时,光标不断向前移动。在它不存在之前,但一旦我连接 onChange 事件,它就会发生。

我的问题:

文本字段问题

我的代码:

 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;
              }


            });
          },
        ),
      )

标签: flutteronchange

解决方案


推荐阅读