Skip to content

Pin Input

A specialized input component designed for entering PIN codes, OTP codes, or other short numeric sequences. The component provides a series of individual input fields that work together as a cohesive unit.

The InputPin widget offers extensive customization options including field shapes, colors, animations, and validation. It’s optimized for security-sensitive inputs with features like text obscuring and autofill support.

  • Security-Focused: Built-in text obscuring and secure input handling
  • Customizable: Supports various shapes, colors, and styling options
  • User-Friendly: Automatic focus management and keyboard handling
  • Validation: Built-in validation and error state support

A standard PIN input with default settings for 5-digit codes.


A PIN input in disabled state that cannot be interacted with.


A PIN input displaying an error state with error styling and pre-filled content.


PropertyTypeDescription
lengthintThe number of PIN input fields to display. Default is 5.
onCompletedFunction(String)?Called when all PIN fields are completed.
autoFocusboolWhether the first field should automatically receive focus.
errorboolWhether the input should display in an error state. Default is false.
enabledboolWhether the input fields are enabled for interaction.
obscureTextboolWhether the input text should be obscured (hidden).
keyboardTypeTextInputTypeThe type of keyboard to display. Default is TextInputType.number.
textStyleTextStyle?Custom text style for the input text.
inputFormattersList<TextInputFormatter>List of input formatters to apply to the text input.
enableActiveFillboolWhether to enable active fill styling.
beforeTextPasteFunction(String?)?Callback to validate text before pasting.
animationTypeAnimationTypeThe type of animation to apply during field transitions.
animationDurationDurationDuration of the animation effects. Default is 300ms.
pinThemePinTheme?Custom pin theme configuration.
obscuringWidgetWidget?Custom widget to display when text is obscured.
mainAxisAlignmentMainAxisAlignmentHow to align the PIN fields horizontally. Default is center.
fieldOuterPaddingEdgeInsetsGeometryPadding around each input field. Default is horizontal 8px.
fieldWidthdoubleWidth of each individual input field. Default is 48px.
activeBorderWidthdoubleBorder width when a field is active (focused). Default is 1.0.
selectedBorderWidthdoubleBorder width when a field is selected. Default is 2.5.
cursorColorColorColor of the text cursor. Default is transparent.
enablePinAutofillboolWhether to enable PIN autofill from system suggestions.
autoDismissKeyboardboolWhether to automatically dismiss keyboard when PIN is completed.
autoFocusOnLoadboolWhether to automatically focus the first field when widget loads.
validatorFunction(String?)?Validation function for the PIN input.
shapePinCodeFieldShapeThe shape of the input fields. Default is circle.
activeBoxShadowList<BoxShadow>?Custom box shadow for active fields.
errorTextMarginEdgeInsetsMargin for error text display. Default is zero.
selectedFillColorColor?Fill color for selected fields.
activeFillColorColor?Fill color for active (focused) fields.
inactiveFillColorColor?Fill color for inactive fields.
selectedColorColor?Border color for selected fields.
activeColorColor?Border color for active (focused) fields.
inactiveColorColor?Border color for inactive fields.
errorBorderColorColor?Border color when in error state.
disabledColorColor?Color when the input is disabled.
onSubmittedFunction(String)?Called when the user submits the input.
onChangedFunction(String)?Called whenever the input value changes.
onEditingCompleteFunction()?Called when the user finishes editing.
controllerTextEditingController?Controller for managing the input text programmatically.