Home > database >  Flutter: TextField_How can I make TextField not foucs when I long-press it?
Flutter: TextField_How can I make TextField not foucs when I long-press it?

Time:03-15

I'm developing an application that has to reorder some elements when I long press it and drag-drop it. Some of the elements has TextField, so when I long press that Element(to reorder with other elements), the TextField is on focus and keyboard appears. I want to make TextField on focus only on tap, not on longPress. Can I make it possible?

CodePudding user response:

Use Attr:

showCursor: true,
readOnly: true

CodePudding user response:

first wrap the textfield in GestureDetector, then try like this

           GestureDetector(
              onLongPress: (){
                readOnly: true
              },
              onTap: //Do your action

            )
  • Related