如何禁用 flutter 文本字段中的智能标点符号?字符串包含撇号时出现问题:“s'habiller”,"Brin d'herbe"

How to disable Smart punctuation in flutter textfield ? Problem when a String contains the apostrophe sign : " s'habiller", "Brin d'herbe"

当字符串包含撇号(单引号)时遇到问题。正在开发一个词汇学习应用程序(法语/英语)。用户必须回答测验。 phone 告诉用户 he/she 类型的翻译是否正确。 只要有撇号,字符串就无法识别。

例如:“一片草”:“un brin d'herbe”/“蜂巢”:“Un nid d'abeilles”。

为了检查答案,我将链分成一个列表:[un,nid,d'abeilles] 即使用户键入“d'abeilles”,它也永远不会被识别为正确的。

我注意到语音转文本功能存在同样的问题:如果用户说“s'habiller”(穿衣服)这个词,我的搜索功能永远找不到它。

有人知道为什么会这样吗?这会是一个“颤动”错误吗?

在应用程序中,我有一个用 Microsoft Excel 创建的词库,然后导入到 visual studio。词库由具有一系列参数的 WORD 对象组成。这是草叶的。

Word(
    id: 37,
    level: 6,
    main: "blade of grass",
    mainFr: "brin d'herbe",
    theme: [
      T(
          e: "house",
          f: "maison",
          ste: ["in the garden"],
          stf: ["dans le jardin"]),
      T(
          e: "nature",
          f: "nature",
          ste: ["in the meadow"],
          stf: ["dans la prairie"])
    ],
    articleEng: "a",
    articleFr: "un",
    nature: "noun",
    plur: "blades of grass ",
    ortho2: "",
    phon: "ˈbleɪd əv ˈgrɑːs",
    son: "",
    remPhon: "",
    french: [],
    syn: [],
    ant: [],
    wDef: "a single thin flat piece of grass.",
    wPhrase: "There was no wind at all. Not a leaf or blade of grass moved.",
    wPhraseFr:
        "Il n'y avait pas de vent du tour. Pas une feuille ni un brin d'herbe ne bougeait.",
    past: [],
    idiomsEn: [],
    idiomsFr: [],
    marqueur: "",
    remarque: "",
  ),

我终于找到了解决这个问题的方法。它确实是使用 Apple 的 SMART PUNCTUATION 实现创建的。使用文本字段时很容易禁用它:

TextFormField(
     smartQuotesType: SmartQuotesType.disabled,