pin_code_fields
A highly customizable PIN/OTP input field for Flutter with Material Design support and headless core for custom UIs.
9.4.0
1000K downloads/mo
#78 most downloaded on pub.dev
adar2378/pin_code_fields
What this package is like to depend on
Last release 3 months ago
20 May 2026
Ships unpredictably
gaps range from 2 weeks to 2.6 years
Some releases are documented
notes for 14 of 55 stable releases
1 version withdrawn
withdrawn after publishing
7 years old
59 releases · first in 2019
6 releases in the last 12 months
see the full history below
Release timeline
59 releases · Jul 2019 to May 2026Releases
latest 59-
9.4.020 May 2026Release notes
Open source →- FIX: suppress semantic hint and focused state when disabled (#427).
- FIX: reorder inputFormatters so user formatters run before length limit.
- FIX: reorder inputFormatters so user formatters run before length limit.
- FEAT: add semanticHintBuilder for customizable accessibility hints.
- FEAT: add custom input formatters demo.
- FEAT: add mainAxisSize property for flexible sizing.
- FEAT: add custom input formatters demo.
2026-02-22
Changes
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
Release notes
Open source →- FIX: suppress semantic hint and focused state when disabled (#427).
- FIX: reorder inputFormatters so user formatters run before length limit.
- FIX: reorder inputFormatters so user formatters run before length limit.
- FEAT: add semanticHintBuilder for customizable accessibility hints.
- FEAT: add custom input formatters demo.
- FEAT: add mainAxisSize property for flexible sizing.
- FEAT: add custom input formatters demo.
-
9.3.029 Mar 2026Release notes
Open source →- FEAT: add
semanticHintBuilderparameter for customizable accessibility hints.- Enables localization of screen reader hints to different languages
- Supports custom terminology (e.g., "characters" instead of "digits")
- Allows static hints for context-specific guidance
- Maintains backward compatibility with default English hints
- Fixes #424
- FEAT: add
-
9.1.022 Feb 2026Release notes
Open source →Features ✨
- Theme Extension: Added
MaterialPinThemeExtensionfor embeddingMaterialPinThemeinThemeData- Register a default PIN theme at the app level using
ThemeData.extensions - Access the theme anywhere with
Theme.of(context).materialPinTheme - Supports light/dark theme configurations
MaterialPinFieldautomatically uses the global theme when no explicitthemeis provided- Added example demo showing app-wide theming usage
- Register a default PIN theme at the app level using
- MaterialPinFormField: New Material Design form field with built-in
Formvalidation- Combines
MaterialPinFieldstyling withFormFieldcapabilities (validator,onSaved,autovalidateMode) - Dual error states: controller errors trigger shake animation, form validation shows error text below the field
- Theme resolution from widget prop,
ThemeDataextension, or default reset()clears both text and controller error state
- Combines
Bug Fixes 🐛
- PinInputFormField: Added missing parameters that exist in
PinInput—onClipboardFound,clipboardValidator,onLongPress,onTapOutside,mouseCursor,semanticLabel
Documentation 📚
- Updated README with "App-Wide Theming" section
- Added code examples for theme extension setup and usage
- Theme Extension: Added
-
9.0.016 Feb 2026Release notes
Open source →Breaking Changes ⚠️
This is a complete rewrite with a new headless architecture. Migration required.
- New Headless Architecture: The package now provides both a headless core (
PinInput) and a Material Design implementation (MaterialPinField) - Unified Controller:
PinInputControllerreplaces separateTextEditingController,FocusNode, anderrorAnimationController - Theme System: New
MaterialPinThemewith automaticColorSchemeresolution - Renamed Parameters: See migration guide below
Features ✨
- Headless Core: Build completely custom PIN UIs with
PinInputandPinCellData - Material Design Ready: Use
MaterialPinFieldfor beautiful, ready-to-use PIN fields - PinInputController: Single controller for text, focus, and error state management
setText(),clear(),text- Text controltriggerError(),clearError(),hasError- Error controlrequestFocus(),unfocus(),hasFocus- Focus control
- Improved Animations: Scale, fade, slide, and none animation types
- All Cell Shapes: Outlined, filled, underlined, and circle
- Text Gradient: Apply gradients to PIN text via
MaterialPinTheme.textGradient - Custom Obscuring Widget: Use any widget for obscuring with
obscuringWidget - Form Integration:
PinInputFormFieldfor form validation - SMS Autofill: Full autofill support with
enableAutofillandautofillHints - Haptic Feedback: Configurable haptic feedback types
- Accessibility (Semantics): Full screen reader support with
semanticLabelparameter- Announces field purpose (e.g., "6-digit PIN code field")
- Provides hints about remaining digits
- Masks values when obscured for privacy
- Exposes enabled/focused states
cursorAlignment: Position custom cursor widgets within cells (e.g., underscore at bottom)onClipboardFound: Callback when clipboard contains valid PIN-like content on focusonTapOutside: Callback when user taps outside the fielderrorText&errorBuilder: Custom error display below the PIN fieldfollowingFillColor&followingBorderColor: Style for cells after the focused cellcompleteFillColor,completeBorderColor&completeTextStyle: Style when all cells are filled
Bug Fixes 🐛
- iOS App Hang fix: All
Clipboard.getDatacalls are now guarded with a 500 ms timeout so a stalled native clipboard never blocks the UI thread - Focus-triggered clipboard probe deferred:
_checkClipboard()dispatched viaaddPostFrameCallbackinstead of running synchronously inside the focus listener - Long-press paste deferred: Default context menu no longer triggers an eager clipboard read; clipboard data is read only after the user explicitly taps Paste
- Centralised safe clipboard helper: All clipboard reads go through
_safeClipboardRead()withtry/catch+.timeout() - Focus on complete: Last cell now shows focused state when PIN is complete and field is focused
- Cursor alignment: Fixed custom cursor positioning - removed internal
Centerwidget that was overriding alignment - Web input: Fixed text input not working on web by adjusting invisible text field configuration
- Controller notifications: Fixed
PinInputControllernot notifying listeners on focus/text changes
Example App 📱
- Added comprehensive use case demos (OTP verification, PIN setup, PIN login, payment confirmation, invite codes, app lock screen)
- Added feature demos for all customization options
- Added interactive Playground for real-time customization of all options
Documentation 📚
- Updated README with demo GIFs showcasing all features
- Added static screenshots for pub.dev gallery
Migration Guide
Parameter Renames
Old Name New Name controllerpinController.textControllerfocusNodepinController.focusNodeuseHapticFeedbackenableHapticFeedbackhapticFeedbackTypeshapticFeedbackTypeanimationTypetheme.entryAnimationenableContextMenuenablePasteerrorAnimationControllerpinController.triggerError()pinThemetheme(MaterialPinTheme)enablePinAutofillenableAutofillBasic Migration
Before (v8.x):
PinCodeTextField( appContext: context, length: 6, controller: textController, focusNode: focusNode, pinTheme: PinTheme( shape: PinCodeFieldShape.box, activeColor: Colors.blue, ), onChanged: (value) {}, onCompleted: (value) {}, )After (v9.0):
final pinController = PinInputController(); MaterialPinField( length: 6, pinController: pinController, theme: MaterialPinTheme( shape: MaterialPinShape.outlined, focusedBorderColor: Colors.blue, ), onChanged: (value) {}, onCompleted: (value) {}, )Error Handling Migration
Before:
final errorController = StreamController<ErrorAnimationType>(); errorController.add(ErrorAnimationType.shake);After:
final pinController = PinInputController(); pinController.triggerError(); // Triggers shake + sets error state pinController.clearError(); // Clears error state
- New Headless Architecture: The package now provides both a headless core (
-
9.0.0-dev.302 Feb 2026 pre-releaseNothing published for this version
-
9.0.0-dev.202 Feb 2026 pre-releaseNothing published for this version
-
8.0.124 Jun 2023Nothing published for this version
-
8.0.024 Jun 2023Nothing published for this version
-
7.5.024 Jun 2023 withdrawnNothing published for this version
-
7.4.003 Apr 2022Nothing published for this version
-
7.3.021 Jul 2021Release notes
Open source →AutovalidateMode.disabled will not add extra space below the pin cells
Added new attributes errorBorderColor, readOnly, textGradient and scrollPadding -
7.2.026 May 2021Release notes
Open source →- Much requested feature placeholder has been added
hintCharacter hintStylehas been added to customize the hint TextStyle
- Much requested feature placeholder has been added
-
7.1.007 May 2021Nothing published for this version
-
7.0.011 Mar 2021Release notes
Open source →Features ✨
- Added
AutofillContextAction, default isAutofillContextAction.commit
Breaking changes ⚠️
- Migrated to null-safety.
- Minimum Flutter version is set to 1.22.0
Fixes 🐛
- Fixed default text value not showing, #153
- Added
-
7.0.0-nullsafety05 Mar 2021 pre-releaseNothing published for this version
-
6.1.020 Jan 2021Release notes
Open source →Features ✨
- Added haptic feedback enum HapticFeedbackTypes { heavy, light, medium, selection, vibrate, }
- Added animated obscure widget support obscuringWidget and blinkWhenObscuring
Fixes 🐛
- Fixed bug related to TextStyle not given.
- Fixed bug related to setState is being called after disposal.
-
6.0.229 Dec 2020Release notes
Open source →Added fallback color when the cursor color fails to retrive and fixed deprecated List constructors.
-
6.0.110 Nov 2020Release notes
Open source →Fixed read-only warning when field is not enabled & cursor animation now only triggers if showCursor = true
-
6.0.010 Oct 2020Release notes
Open source →Features ✨
-
Added Cursor
`
/// Whether to show cursor or not
final bool showCursor;/// The color of the cursor, default to Theme.of(context).accentColor
final Color cursorColor;/// width of the cursor, default to 2
final double cursorWidth;/// Height of the cursor, default to FontSize + 8;
final double cursorHeight;
` -
Added boxhShadows
Breaking changes ⚠️
autoValidatechanged according to the new version of Flutter- Minimum Flutter version is set to 1.22.0
Fixes 🐛
- typo fixes
-
-
5.2.003 Oct 2020Nothing published for this version
-
5.1.016 Sep 2020Release notes
Open source →[5.1.0]
Features ✨
- Added
errorAnimationDurationto customize Error animation duration. - Added
enablePinAutofillto enable or disable the auto-fill feature.
Breaking changes ⚠️
- Chagned
textInputTypeto more familiarkeyboardTypeto change they keyboard type
Fixes 🐛
- Fixed rootNavigator issue for paste dialogs, #101
- Added
-
5.0.118 Aug 2020Nothing published for this version
-
5.0.015 Aug 2020Release notes
Open source →Features ✨
- Added onSave, onTap callbacks.
- Added PastedTextStyle.
- Added iOS autofill added wtih Flutter version 1.20.0
Breaking changes ⚠️
- Must provide context in the
appContextparameter. - Minimum Flutter version is set to 1.20.0
Fixes 🐛
- Reopen keyboard onTap on the cells #92, thanks to https://github.com/YaroslavGS for the suggestion
-
4.0.015 Jul 2020Release notes
Open source →Features ✨
Added support for flutter-web
Breaking changes ⚠️
Replaced internal automatic OS selection for dialog styles, you can select which style you want by configuring with the DialogConfig -
3.1.214 Jun 2020Nothing published for this version
-
3.1.114 Jun 2020Nothing published for this version
-
3.1.014 Jun 2020Nothing published for this version
-
3.0.118 May 2020Nothing published for this version
-
3.0.003 May 2020Nothing published for this version
-
2.5.111 Apr 2020Nothing published for this version
-
2.5.011 Apr 2020Nothing published for this version
-
2.4.010 Mar 2020Nothing published for this version
-
2.3.029 Nov 2019Nothing published for this version
-
2.3.0+129 Nov 2019Nothing published for this version
-
2.3.0+211 Dec 2019Nothing published for this version
-
2.3.0+317 Dec 2019Nothing published for this version
-
2.2.124 Nov 2019Nothing published for this version
-
2.2.1+127 Nov 2019Nothing published for this version
-
2.2.1+227 Nov 2019Nothing published for this version
-
2.2.022 Nov 2019Nothing published for this version
-
2.2.0+122 Nov 2019Nothing published for this version
-
2.2.0+223 Nov 2019Nothing published for this version
-
2.2.0+323 Nov 2019Nothing published for this version
-
2.2.0+423 Nov 2019Nothing published for this version
-
2.1.117 Nov 2019Nothing published for this version
-
2.1.017 Nov 2019Nothing published for this version
-
2.0.403 Nov 2019Nothing published for this version
-
2.0.301 Nov 2019Nothing published for this version
-
2.0.213 Oct 2019Nothing published for this version
-
2.0.112 Oct 2019Nothing published for this version
-
2.0.012 Oct 2019Nothing published for this version
-
1.1.229 Jul 2019Nothing published for this version
-
1.1.129 Jul 2019Nothing published for this version
-
1.1.029 Jul 2019Nothing published for this version
-
1.0.427 Jul 2019Nothing published for this version
-
1.0.327 Jul 2019Nothing published for this version
-
1.0.227 Jul 2019Nothing published for this version
-
1.0.127 Jul 2019Nothing published for this version
-
1.0.027 Jul 2019Nothing published for this version