晦涩的文本使退格键一次删除两个字符

Obscure Text Makes Backspace Remove Two Characters at a Time

我正在用 Flutter 开发一个应用程序。该应用程序在 iOS 中运行没有问题,似乎可以与 Swiftkey 键盘一起正常运行,但我在使用 gBoard 和三星键盘时遇到问题。

当我为 TextFieldTextFormFieldobscureText 值设置为 true 时,键盘上的退格键一次删除两个字符。当 obscureText 字段为 false 时,它可以正常工作。此外,我可以将 obscureText 字段设置为 true,如果我使用 Switkey 键盘,它会正常工作。

我找遍了,没有找到与此相关的内容,所以我很困惑。我已尝试将我的屏幕恢复为绝对准系统代码以确定是否存在配置问题或可能存在依赖性问题,但问题仍然存在。

这是罪魁祸首的 TextFormField 小部件:

TextFormField(
                      obscureText: true,
                      decoration: InputDecoration(
                        enabledBorder: InputBorder.none,
                        focusedBorder: InputBorder.none,
                        hintStyle: TextStyle(
                            fontSize: textSizeLarge,
                            color: t12_text_secondary
                        ),
                        hintText: 'Hours...',
                        prefixIcon: Icon(
                          Icons.access_time,
                          color: t12_text_secondary,
                          size: 25,
                        ),
                        fillColor: Colors.white,
                        filled: true,
                      ),
                      style: TextStyle(
                          fontSize: textSizeLarge,
                          color: t12_text_color_primary,
                          fontFamily: fontRegular,
                          height: 1.5
                      ),
                      validator: (value) {
                        if(value.isEmpty){
                          return "Date Required";
                        }else if(!helpers.isDouble(value)){
                          return "Value must be a number";
                        }
                        else{
                          return null;
                        }
                      },
                    ),

这可能与 Flutter Issue 70744 和其他类似问题有关。

最近出现了一些 TextInputType 错误,可能是因为对 SDK 进行了调整以支持 Web、Linux 和 Windows 发布目标。

我在使用 'beta' flutter 通道时遇到了这个问题。改成'stable'频道后就解决了。我认为这个问题仍然是 'beta' 频道的一个错误。

您可以在终端中输入 'flutter --version' 来查看您的频道。

如果不是 'stable' 频道,您可以通过在终端中输入 'flutter channel stable' 来更改它。