【发布时间】:2020-01-09 23:47:42
【问题描述】:
在这里我遇到了一些问题。如何向纯文本字段或用于 OTP 输入的任何字段添加验证。如果有人有另一个 OTP 输入字段,请告诉我。希望你能理解。请帮帮我。
_onAlertotp(context) {
Alert(
context: context,
title: "OTP expires in: MM:SS (Counter",
desc:
"We have Texted and/or Emailed OTP (One Time Pin) to your registered cell phone and/ or email account. Please check and enter OTP below to activate your TUDO account",
content: Column(
children: <Widget>[
Form(
autovalidate: true,
child: PinField(
padding: EdgeInsets.all(16.0),
length: 6,
gap: 6.0,
onSubmitted: Validators().otpValidate,
keyboardType: TextInputType.numberWithOptions(signed: true),
inputFormatters: [WhitelistingTextInputFormatter.digitsOnly]),
)
],
),
buttons: [
DialogButton(
onPressed: () => Navigator.pop(context),
child: Text(
"Resend OTP",
style: TextStyle(color: Colors.white, fontSize: 20),
),
),
DialogButton(
onPressed: () {
_onAlertrunningbusiness(context);
},
child: Text(
"Enter Otp",
style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
}
【问题讨论】:
-
该字段没有验证器属性
标签: validation flutter textfield flutter-layout one-time-password