'How to get Flutter TextField onLongpress callback when textfield has focus?

Is it a way to get the onLongpress call from flutter TextField? It has an onTap callback by defaul, but i need the onLongpress ?

TextField(onLongpress : ()=>...

Detailed behaviour :

  1. text field is focused,cursor is blinking
  2. Longpress on textfield
  3. Override textfield on lonpress behaviour (By default textfield selects a word under the cursor)


Solution 1:[1]

I could have given you a more direct approach if I know your Use Case.

But this works Pretty Fine.

   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',
                  ),
                ),
              ),
            ),

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 THEODORE