简体   繁体   English

如何在 Flutter 的 TextFormField 中显示拼写检查器(带下划线的错误拼写)?

[英]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.

相关问题 颤振:在TextFormField图标下划线 - Flutter: Underline below TextFormField icon 如何在 Flutter 中的 TextFormField 中显示错误文本,而不是在其中 - How to show error text in TextFormField in Flutter below it and not in it 如何在 Flutter 的 TextFormField 中插入/显示 HTML 元素? - How to insert/show HTML element in a TextFormField in Flutter? 如何删除 TextFormField 中输入文本的下划线? - How to remove underline of input text in the TextFormField? 如何使用下拉按钮创建 TextformField 以在 flutter 中显示图标和文本列表 - How to create TextformField with Dropdown button to show list of icons and text in flutter 如何在 Flutter 中以固定行数显示一个 TextFormField 的最后一行 - How to show last line of one TextFormField with fixed number of lines in Flutter 如何在flutter中的textformfield边界内显示标签和错误消息? - How to show label and error message inside the boundry of textformfield in flutter? 如何在 flutter 的每个帖子下显示和使用 textformfield? - How to show and use textformfield under each post in flutter? Flutter Textformfield 如何在 Textformfield 中居中文本 - Flutter Textformfield How to center text in a Textformfield 验证 Flutter 中的 TextFormField - 这个正则表达式有什么问题? - Validate TextFormField in Flutter - What's wrong with this Regex?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM