v2.2.0sms_otp_auto_verify
一个用于输入数字验证码的新Flutter插件,通常用于短信OTP代码场景,并使用SMS Retriever API库提供短信自动填充功能。
93喜欢 73近 30 天下载140Pub 分数
Android
oohyugi/sms_otp_auto_verify open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
A new Flutter plugin to enter a digit code usually in cases of Sms Otp Code. and provide SMS Auto Fill using library SMS Retriever API.
import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart';
String? signature = await SmsVerification.getAppSignature();
codeLength must equals with Sms OTP Code length
TextFieldPin(
textController: textEditingController,
autoFocus: true,
codeLength: _otpCodeLength,
alignment: MainAxisAlignment.center,
defaultBoxSize: 46.0,
margin: 10,
selectedBoxSize: 46.0,
textStyle: TextStyle(fontSize: 16),
defaultDecoration: _pinPutDecoration.copyWith(
border: Border.all(
color: Theme.of(context)
.primaryColor
.withOpacity(0.6))),
selectedDecoration: _pinPutDecoration,
onChange: (code) {
_onOtpCallBack(code,false);
}),
_onOtpCallBack(String otpCode, bool isAutofill) {
setState(() {
this._otpCode = otpCode;
if (otpCode.length == _otpCodeLength && isAutofill) {
_enableButton = false;
_isLoadingButton = true;
_verifyOtpCode();
} else if (otpCode.length == _otpCodeLength && !isAutofill) {
_enableButton = true;
_isLoadingButton = false;
}else{
_enableButton = false;
}
});
}
<#> ExampleApp: Your code is 5664
r64Iw/6mD1D
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗