flutter textformfield do d dy do not;或'ç'输入

发布于 2025-01-27 20:11:35 字数 1449 浏览 5 评论 0 原文

我在应用程序中的所有Textformfield小部件中都有这种奇怪的行为,给定给定给出的输入,Caret将移动到ç/ç的前面,而不是在其后面移动(在Android和iOS上观察到)。除了那种奇怪的行为,如果我要插入一封新信,那将不会放在ç/ç的前面(人们可能会假设的b/c),不,它覆盖了ç /ç以一种奇怪的方式形成两个字母的混合,好像应用程序不知道实际上已经有一个字母了。请检查所附图片。

我可以确认这不是字体问题,也不是UTF。该字体能够显示Cedilla C,并且仅使用TextFormField构建新的Flutter应用程序将不会再现此问题。所以,我必须缺少一些东西。

我使用的是一个几乎基本的默认textformfield,而没有自定义的textedingcontroller。我不想为每个TextFormField实例化一个自定义的TextEditingController,以便将解决方法传递到它(例如检查Ç/ç和将其移动在其后面))B/C如前所述,我知道默认的TextFormfield可以与Cedilla一起工作正常c。我希望有人知道一些配置问题或其他问题。

这是一个符合此行为的TextFormField的示例:

          TextFormField(
        decoration: const InputDecoration(labelText: 'Name it'),
        validator: (value) {
          if (value!.isEmpty) {
            return 'Name is missing';
          }
          // case: name already exists
          final check = context.read<BookState>().when((books) {
            if (books.any((e) => e.name == value)) {
              return 'Name already exists';
            }
          }, empty: () => null);
          // case: all good
          return check;
        },
        onSaved: (value) => bookName = value!,
      )

I have this strange behavior throughout all TextFormField widgets in my app that given a Ç or ç input the caret will move back in front of the Ç/ç instead of behind it (observed on Android and iOS). On top of that strange behavior, if I was to insert a new letter, that new letter wouldn't be placed in front of the Ç/ç (as one might assume b/c of the caret), no, it overwrites the Ç/ç in a strange way forming a mix of two letters as if the application didn't know that there's actually a letter already in place. Please check the attached pictures.

I can confirm that this is not a font issue nor an UTF one. The font is capable of displaying a cedilla c, and building a new flutter app with just a TextFormField will not reproduce this issue. So, I've got to be missing something.

I am using a pretty much basic default TextFormField without a custom TextEditingController. I do not want to instantiate a custom TextEditingController for each TextFormField in order to pass a workaround to it (like checking for Ç/ç and moving the caret behind it) b/c as mentioned I know that the default TextFormField works just fine with cedilla c. I hope somebody knows about maybe some config issue or whatnot.

Here's an example of a TextFormField that runs into this behavior:

          TextFormField(
        decoration: const InputDecoration(labelText: 'Name it'),
        validator: (value) {
          if (value!.isEmpty) {
            return 'Name is missing';
          }
          // case: name already exists
          final check = context.read<BookState>().when((books) {
            if (books.any((e) => e.name == value)) {
              return 'Name already exists';
            }
          }, empty: () => null);
          // case: all good
          return check;
        },
        onSaved: (value) => bookName = value!,
      )

caret immediately placed in front of ç
resulting in an odd overwriting

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十二 2025-02-03 20:11:36

如果您转到 textfortfordfield 页面页面并进行测试,您会看到那个有正确的行为

If you go to TextFormField page and test it, you will see that have the correct behaviour

乄_柒ぐ汐 2025-02-03 20:11:36

我最近更新了Flutter SDK以及一些新版本的依赖项。从那时起,问题就解决了,没有真正触摸Textformfield小部件。我想这是依赖性的错误。 Google_fonts可能是接受主要版本升级的候选人...

I recently updated the flutter sdk as well as some of my dependencies for a new release. The problem is resolved since then without having actually touched the TextFormField widgets. I guess it was a bug in a dependency. google_fonts could be a candidate which received a major version upgrade ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文