Home > Software engineering >  How can I add foreign language characters in #TextField in Flutter?
How can I add foreign language characters in #TextField in Flutter?

Time:01-16

I am developing a language app and my question is related to this. In this app, I can show the words from the local database that contain foreign characters in the app. Yet, when the users want to add a new word in a foreign language, the app does not recognize the foreign characters.

How can I make users add Turkish characters (or any other characters than English) in TextField in flutter? I am pretty new to developing apps. Any helpful answers would be really appreciated. I really thank you in advance for any help you can provide.

CodePudding user response:

To allow users to input Turkish characters or anyother character in Flutter, you will need to configure the TextField's inputFormatters property.

Use this code, it might help you:

TextField(
  inputFormatters: [
    WhitelistingTextInputFormatter(RegExp("[a-zA-ZığüşöçİĞÜŞÖÇ ]"))
  ],
)

It has the regex for Turkish and you can tweak this accordingly.

CodePudding user response:

You don't need to recognize for the language in TextField, Because the TextField can have any data in any language, You just have to change your own keyboard language to the language you want and you can start typing into that language like any other language.

  • Related