[英]How to show spellchecker(wrong spelling with underline) in TextFormField in Flutter?
In my application I have a story line - Forgive user typos in search makes it effortless for the users.在我的应用程序中,我有一个故事情节——原谅用户在搜索中的拼写错误,这对用户来说毫不费力。 So what exactly I want when I type something in TextFormField it should do spellchecker.
因此,当我在 TextFormField 中键入内容时,我到底想要什么,它应该进行拼写检查。 Is there is any solution for that in flutter?
flutter 有解决办法吗? Kindly find the attached screenshot.
请找到随附的屏幕截图。
You should use a spellcheck api service for this like Bing Spell Check API it will return the mistakes in the text and you can underline them.您应该为此使用拼写检查 api 服务,例如Bing 拼写检查 API它将返回文本中的错误,您可以在它们下划线。 Here is the respond of your text;
这是您的文字的回应;
{
"_type": "SpellCheck",
"flaggedTokens": [
{
"offset": 14,
"token": "Sofyware",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "Software",
"score": 0.9140160264956476
}
]
}
]
}
here is some APIs you can check them out and select which one works for you.这是一些您可以查看的 API 和 select 哪一个适合您。
And here is a package include english words that you can check if the word inside it;这是一个 package 包含英文单词,您可以检查其中的单词是否; https://pub.dev/packages/list_english_words
https://pub.dev/packages/list_english_words
This feature has landed in Flutter 3.7.该功能已登陆Flutter 3.7。 To use it, add this parameter to your EditableText or TextField:
spellCheckConfiguration: kIsWeb? null: SpellCheckConfiguration()
要使用它,请将此参数添加到您的 EditableText 或 TextField:
spellCheckConfiguration: kIsWeb? null: SpellCheckConfiguration()
spellCheckConfiguration: kIsWeb? null: SpellCheckConfiguration()
. spellCheckConfiguration: kIsWeb? null: SpellCheckConfiguration()
。
(The spell check configuration currently seems to break on web) (拼写检查配置目前似乎在网络上中断)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.