InputOTPChild class abstract
Abstract base class for OTP input child elements.
Defines the interface for children that can be placed within an InputOTP widget, including actual input fields, separators, and spacers. Subclasses implement the build method to render their content.
Common factories:
- separator: Creates a visual separator between OTP groups.
- space: Creates spacing between OTP input fields.
- empty: Creates an empty placeholder.
- InputOTPChild.input: Creates a configurable character input.
- InputOTPChild.character: Creates a character input with preset filters.
Example:
InputOTP(
children: [
InputOTPChild.input(predicate: (cp) => cp >= 48 && cp <= 57),
InputOTPChild.space,
InputOTPChild.input(),
],
)
- Implementers
Constructors
- InputOTPChild()
-
Creates an InputOTPChild.
const
- InputOTPChild.character({bool allowLowercaseAlphabet = false, bool allowUppercaseAlphabet = false, bool allowDigit = false, bool obscured = false, bool onlyUppercaseAlphabet = false, bool onlyLowercaseAlphabet = false, bool readOnly = false, TextInputType? keyboardType})
-
Creates a character input with alphabet and digit filtering.
factory
- InputOTPChild.input({CodepointPredicate? predicate, CodepointUnaryOperator? transform, bool obscured = false, bool readOnly = false, TextInputType? keyboardType})
-
Creates a customizable character input field.
factory
Properties
Methods
-
build(
BuildContext context, InputOTPChildData data) → Widget - Builds the widget for this OTP child.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- empty → InputOTPChild
-
An empty placeholder that takes no space.
no setter
- separator → InputOTPChild
-
A visual separator between OTP groups (e.g., a dash or line).
no setter
- space → InputOTPChild
-
Spacing between OTP input fields.
no setter