A Flutter package that provides a customizable OTP (One-Time Password) input field.
To use this package, add otp_input
as a dependency in your pubspec.yaml
file:
dependencies:
otp_input: ^1.0.3
flutter pub get
Import the package in your Dart file:
import 'package:otp_input/otp_input.dart';
Add the OtpInputField widget to your widget tree:
OtpInputField(
otpInputFieldCount: 4,
width: 0.2,
onOtpEntered: (otp) {
print('Entered OTP: $otp');
// Perform actions with the entered OTP
},
)
- otpInputFieldCount: The number of OTP input fields.
- width: The width factor of each input field, a value between 0.0 and 1.0.
- onOtpEntered: Callback function triggered when all OTP fields are filled.
Feel free to open issues or contribute to this package on GitHub.