Flutter AutofillHints oneTimeCode 不起作用

Osm*_*man 5 textfield one-time-password dart flutter

我想捕获 OTP 短信代码,但它在 IOS 上不起作用。我需要显示键盘上方的代码。

我的代码块是;

TextField(
 controller: controller,
 autofillHints: const <String>[AutofillHints.oneTimeCode],
 keyboardType: TextInputType.number,
 onChanged: onChanged,
),
Run Code Online (Sandbox Code Playgroud)

小智 2

来自https://master-api.flutter.dev/flutter/material/TextField/autofillHints.html上的 Flutter 文档“某些自动填充提示仅适用于特定的键盘类型”。尝试更改键盘类型。例如:

TextField(
 controller: controller,
 autofillHints: const <String>[AutofillHints.oneTimeCode],
 keyboardType: TextInputType.text,
 onChanged: onChanged,
),
Run Code Online (Sandbox Code Playgroud)