A highly customizable Flutter OTP (One-Time Password) input field package with a built-in custom keyboard. Perfect for secure authentication flows with support for numbers, alphanumeric, and special characters.
- π¨ Fully Customizable - Colors, sizes, borders, and styles
- β¨οΈ Custom Keyboard - MacBook-style keyboard layout (no native keyboard needed)
- π’ Multiple Character Types - Numbers only, alphanumeric, or full character set
- π Secure by Default - 6+ character minimum recommended, masked input option
- π± Responsive Design - Adapts to different screen sizes
- π― Auto-Focus Management - Smooth navigation between fields
- π Masked/Visible Toggle - Show dots or actual characters
- π Modern Flutter - Built with Flutter 3.x and Material 3
- π― Null Safe - Complete null safety support
![]() |
![]() |
![]() |
| Alphanumeric Mode | Numbers Only | Full Characters |
Add this to your package's pubspec.yaml file:
dependencies:
otp_numpad: ^0.0.1Then run:
flutter pub getimport 'package:otp_numpad/otp_numpad.dart';OtpFieldWidget(
config: OTPConfig(
length: 6,
characterType: CharacterType.alphanumeric,
obscureText: true,
),
onCompleted: (pin) {
print('OTP Entered: $pin');
// Verify with your backend
},
)OtpFieldWidget(
config: OTPConfig(
length: 4,
characterType: CharacterType.numbersOnly,
obscureText: false,
),
onCompleted: (pin) {
// Verify PIN
},
)OtpFieldWidget(
config: OTPConfig(
length: 8,
characterType: CharacterType.full,
obscureText: true,
// Field customization
fieldWidth: 55.0,
fieldHeight: 65.0,
fieldSpacing: 12.0,
borderRadius: 15.0,
// Field colors
borderColor: Colors.grey.shade300,
focusedBorderColor: Colors.blue,
filledBorderColor: Colors.green,
// Keyboard customization
keyboardHeight: 300.0,
// Text style
textStyle: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
onChanged: (value) {
print('Current value: $value');
},
onCompleted: (pin) {
print('Completed: $pin');
},
)| Type | Description | Keyboard Layout |
|---|---|---|
CharacterType.numbersOnly |
Numbers 0-9 only | 3x4 numeric keypad |
CharacterType.alphanumeric |
Letters and numbers | QWERTY + numbers |
CharacterType.full |
All characters including symbols | Full MacBook-style layout |
| Parameter | Type | Default | Description |
|---|---|---|---|
length |
int |
6 |
Number of OTP fields (4-8) |
characterType |
CharacterType |
alphanumeric |
Type of characters allowed |
obscureText |
bool |
true |
Show dots instead of characters |
fieldWidth |
double |
50.0 |
Width of each field |
fieldHeight |
double |
60.0 |
Height of each field |
fieldSpacing |
double |
10.0 |
Space between fields |
borderRadius |
double |
12.0 |
Border radius of fields |
| Parameter | Type | Default | Description |
|---|---|---|---|
borderColor |
Color |
Color(0xFFE0E0E0) |
Default border color |
focusedBorderColor |
Color |
Color(0xFF6366F1) |
Border color when focused |
filledBorderColor |
Color |
Color(0xFF10B981) |
Border color when filled |
| Callback | Description |
|---|---|
onChanged(String value) |
Called whenever the OTP value changes |
onCompleted(String value) |
Called when all fields are filled |
For maximum security, we recommend:
- β Use at least 6 characters
- β Enable alphanumeric or full character mode
- β Keep obscureText enabled (dots instead of visible characters)
- β Implement rate limiting on your backend
- β Use time-based expiration for OTPs
- β Never store OTPs in plain text
Check out the example directory for a complete demo app showcasing all features.
To run the example:
cd example
flutter pub get
flutter runflutter testflutter format .flutter analyzeContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this package helpful, please give it a βοΈ on GitHub!
- Author: Connel Asikong
- Email: connelblaze@gmail.com
- GitHub: @connelevalsam
See CHANGELOG.md for a list of changes.
Made with β€οΈ and Flutter


