skip to Main Content

I searched everywhere and couln’t find any solution…

How to disable the image insert/gif/translation options in the TextField/TextFormField widgets?

enter image description here

6

Answers


  1. make the enableInteractiveSelection property to false of the TextField

    enableInteractiveSelection:false,
    

    you can read the details in the official documentation here

    Login or Signup to reply.
  2. Try setting the KeyboardType to accept only text in the TextField:

    TextFormField(
      keyboardType: TextInputType.text,
      // or keyboardType: TextInputType.multiline,
      ...
    )
    
    Login or Signup to reply.
  3. You can use the bellow property for TextField and TextFormField

    enableSuggestions: false,
    

    to stop the keyboard suggesion.

    Login or Signup to reply.
  4. Have a look at this and see if this workaround helps in your usecase.

    hide gif/sticker in keyboard

    This is usually normal keyboard behaviour to have those options not that it would work even if users tapped on it.

    If you wish, you can code a custom keyboard without distractions by following add custom keyboard

    Login or Signup to reply.
  5. You can disable the option to insert images into a TextField in Flutter by creating a custom

    TextEditingController

    and overwriting the

    buildView

    method to return a plain TextField.

    create this

    class NoImageTextEditingController extends TextEditingController {
      @override
      TextSpan buildTextSpan({TextStyle style, bool withComposing}) {
        return super.buildTextSpan(style: style, withComposing: false);
      }
    }
    

    and use it like this

    TextField(
      controller: NoImageTextEditingController(),
      decoration: InputDecoration(
        hintText: "Enter your text here",
      ),
    )
    
    Login or Signup to reply.
  6. Your gif and all suggestion is coming from the keyboard app there is some way to disable it, like if we apply password container textformfiled then it is possible like below :

    Another way is you have to make custom keyboard for it

               TextFormField(
                          keyboardType: TextInputType.visiblePassword, // add this line
                          controller: textEditingController,
                          cursorColor: AppTheme.secondaryColor,
    

    Other solution is please add this property

      keyboardType: TextInputType.multiline
      enableSuggestions: false,
      autocorrect: false,
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search