OudsDigitInput class

A Digit Input refers to a single input box that accepts exactly one numeric character (0–9). In the context of a PIN code or OTP, multiple digit inputs are placed side by side, each holding one digit, to form the complete code.

Parameters:

  • index: The index of this digit input within the PIN code sequence.
  • isError: The Error status indicates that the user input does not meet validation rules or expected formatting. It provides immediate visual feedback, typically through a red border, error icon, and a clear, accessible error message positioned below the input
  • digitInputDecoration: Defines the decoration of each digit input box OudsDigitInputDecoration
  • controller: Controller for managing the text value of this digit.
  • focusNode: Focus node to manage keyboard focus for this digit input.
  • isHovered: Whether the digit input is currently hovered.
  • onChanged: Callback triggered when the digit value changes. Provides the new value and the index of this digit.

You can use OudsDigitInput like this :

This is the default style of the component.

OudsDigitInput(
   index: index,
   isError: true,
   hiddenPassword: widget.hiddenPassword,
   digitInputDecoration: OudsDigitInputDecoration(
         hintText: widget.hintText,
         style: widget.style,
         roundedCorner: widget.roundedCorner
       ),
    focusNode: _focusNodes[index],
    isHovered: _isHovered[index],
    controller:  widget.controllers[index],
    onChanged: (value, index) {},
  )
Inheritance

Constructors

OudsDigitInput.new({Key? key, required int index, bool isError = false, OudsDigitInputDecoration? digitInputDecoration, TextEditingController? controller, FocusNode? focusNode, bool isHovered = false, void onChanged(String, int)?, OudsPinCodeInputLength length = OudsPinCodeInputLength.six})

Properties

controller TextEditingController?
final
digitInputDecoration OudsDigitInputDecoration?
final
focusNode FocusNode?
final
hashCode int
The hash code for this object.
no setterinherited
index int
final
isError bool
latefinal
isHovered bool
latefinal
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
length OudsPinCodeInputLength
final
onChanged → void Function(String, int)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<OudsDigitInput>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited