skip to Main Content

I am building an app in flutter for android pos device. but i want to hide the keyboard
when clicking on the textfield. how can i achieve that ?

I’ve tried the following code

FocusManager.instance.primaryFocus?.unfocus();

when i calling this code nothing can be entered and the third or fourth tap keyboard popes again

2

Answers


  1. try this:

    TextField(
      showCursor: true,
      readOnly: true),
    

    found here : https://stackoverflow.com/a/60106951/12838877

    Login or Signup to reply.
  2. try this,

    InkWell(
      onTap: (){
        FocusManager.instance.primaryFocus?.unfocus();
      },
      child: AbsorbPointer(
        absorbing: true,
        child: TextField(),
      ),
    )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search