当文本字段获得焦点时,如何获取 Flutter TextField onLongpress 回调?

Vik*_*Jr. 0 textfield long-press flutter

这是从 flutter TextField 获取 onLongpress 调用的方法吗?它默认有一个 onTap 回调,但我需要 onLongpress ?

TextField(onLongpress : ()=>...
Run Code Online (Sandbox Code Playgroud)

详细行为:

  1. 文本字段获得焦点,光标闪烁
  2. 长按文本字段
  3. 覆盖长按行为的文本字段(默认情况下,文本字段选择光标下的单词)

The*_*MCA 5

如果我了解您的用例,我可以为您提供更直接的方法。

但这工作得很好。

   InkWell(
       onLongPress: () {
                print("onlong Press");
                },
              child: IgnorePointer(
                ignoring: true,  // You can make this a variable in other toggle True or False 
                child: TextField(
                  decoration: InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Password',
                    hintText: 'Enter Password',
                  ),
                ),
              ),
            ),
Run Code Online (Sandbox Code Playgroud)