|
|
|
@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
|
|
|
|
|
|
|
|
import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart';
|
|
|
|
|
|
|
|
|
|
|
|
typedef OnDone = void Function(String text);
|
|
|
|
typedef OnDone = void Function(String text);
|
|
|
|
|
|
|
|
|
|
|
|
@ -132,6 +133,7 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
|
|
|
|
widget.controller!.addListener(_controllerListener);
|
|
|
|
widget.controller!.addListener(_controllerListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
focusNode.addListener(_focusListener);
|
|
|
|
focusNode.addListener(_focusListener);
|
|
|
|
|
|
|
|
checkSignature();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _controllerListener() {
|
|
|
|
void _controllerListener() {
|
|
|
|
@ -209,7 +211,15 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void checkSignature() async {
|
|
|
|
|
|
|
|
SmsVerification.startListeningSms().then((message) {
|
|
|
|
|
|
|
|
final intRegex = RegExp(r'\d+', multiLine: true);
|
|
|
|
|
|
|
|
var otp = SmsVerification.getCode(message, intRegex);
|
|
|
|
|
|
|
|
widget.controller!.text = otp;
|
|
|
|
|
|
|
|
_onTextChanged(text);
|
|
|
|
|
|
|
|
SmsVerification.stopListening();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
Widget _touchPinBoxRow() {
|
|
|
|
Widget _touchPinBoxRow() {
|
|
|
|
return widget.hideDefaultKeyboard
|
|
|
|
return widget.hideDefaultKeyboard
|
|
|
|
? _pinBoxRow(context)
|
|
|
|
? _pinBoxRow(context)
|
|
|
|
@ -462,6 +472,7 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
_otpController = TextEditingController();
|
|
|
|
_otpController = TextEditingController();
|
|
|
|
_startResendTimer();
|
|
|
|
_startResendTimer();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -506,6 +517,7 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
|
|
|
|
_startResendTimer();
|
|
|
|
_startResendTimer();
|
|
|
|
// autoFillOtp("1234");
|
|
|
|
// autoFillOtp("1234");
|
|
|
|
widget.onResendOTPPressed(widget.phoneNumber);
|
|
|
|
widget.onResendOTPPressed(widget.phoneNumber);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -618,5 +630,11 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
|
|
|
|
if (otp.length != _otpLength) return;
|
|
|
|
if (otp.length != _otpLength) return;
|
|
|
|
_isVerifying = false;
|
|
|
|
_isVerifying = false;
|
|
|
|
_otpController.text = otp;
|
|
|
|
_otpController.text = otp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|