otp_text_field
1.1.5, released 3 months ago by vivekkaushik.com
A Flutter widget to create customizable OTP and PIN input fields.
WASM-ready
What it does
Provides an OTP text field widget allowing developers to specify length, field width, styles, and callbacks for completion. Supports quick paste functionality, controllers, input formatters, and backspace handling.
AI-written summary of version 1.1.5, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to build a verification screen or PIN entry form.
- You want automatic focus management across multiple text input boxes for OTP codes.
Skip it when
- You require complex form validation systems that are better handled by full form-building libraries.
Strengths
- Supports quick paste and controller management.
- Customizable field appearance (underline, box style, colors, background color).
- Handles backspace navigation between fields automatically.
Weaknesses
- Field layout is always left-to-right, which may impact right-to-left localization requirements.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
OTPTextField(
length: 5,
width: MediaQuery.of(context).size.width,
fieldWidth: 80,
style: TextStyle(
fontSize: 17
),
textFieldAlignment: MainAxisAlignment.spaceAround,
fieldStyle: FieldStyle.underline,
onCompleted: (pin) {
print("Completed: " + pin);
},
)Alternatives
Packages that do the same job and could replace otp_text_field.
- pinput
A feature-rich alternative for PIN and OTP input fields with extensive customization.
93Compare - pin_code_fields
Another popular alternative package for creating pin code input text fields.
93Compare - pin_input_text_field
A simpler pin input text field package alternative.
88Compare