如何检测文本字段颤动中的otp文本

问题描述 投票:0回答:1

如何在 flutter 中自动检测文本字段的 otp 文本 我没有得到任何合适的东西。 在此先谢谢了。

 Center(
              child: Padding(
                padding: const EdgeInsets.only(top: 10.0),
                child:TextField(
                  controller: otpController,
                  maxLength: 6,
                  maxLengthEnforced: true,
                  textAlign: TextAlign.center,
                  decoration: InputDecoration(
                    border: InputBorder.none,
                    hintText: "_ _ _ _ _ _",
                    hintStyle: new TextStyle(
                      fontWeight: FontWeight.bold
                    )

//          border:
//          OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))
                  ),
                  style: new TextStyle(
                    color: Colors.black,
                    fontWeight: FontWeight.bold,
                    fontSize: 22.0,
                  ),
                ),
              ),
            ),
dart flutter textfield
1个回答
0
投票

您可以使用 sms_autofill 插件自动用 OTP 填充 PinFieldAutoFill。要监听 OTP 代码更改,您可以使用

onCodeChanged
属性。

© www.soinside.com 2019 - 2024. All rights reserved.