OTPTextField class

Inheritance

Constructors

OTPTextField({Key? key, int length = 4, double width = 10, OtpFieldController? controller, double fieldWidth = 30, double spaceBetween = 0, OtpFieldStyle? otpFieldStyle, bool hasError = false, TextInputType keyboardType = TextInputType.number, TextStyle style = const TextStyle(), double outlineBorderRadius = 10, TextCapitalization textCapitalization = TextCapitalization.none, MainAxisAlignment textFieldAlignment = MainAxisAlignment.spaceBetween, bool obscureText = false, bool showCursor = false, FieldStyle fieldStyle = FieldStyle.underline, ValueChanged<String>? onChanged, List<TextInputFormatter>? inputFormatter, EdgeInsets contentPadding = const EdgeInsets.symmetric(horizontal: 4, vertical: 8), bool isDense = false, ValueChanged<String>? onCompleted, bool autofocus = false, bool enabled = true, List<String>? autofillHints, bool redirectFocusToFirstEmptyField = true})
const

Properties

autofillHints → List<String>?
Autofill hints applied to the first field.
final
autofocus → bool
Whether the first field is focused automatically when the widget is built. Defaults to false.
final
contentPadding → EdgeInsets
content padding of the text fields
final
controller → OtpFieldController?
TextField Controller
final
enabled → bool
Whether the fields are enabled for user interaction. Defaults to true.
final
fieldStyle → FieldStyle
Text Field Style for field shape. default FieldStyle.underline FieldStyle
final
fieldWidth → double
Width of the single OTP Field
final
hasError → bool
show the error border or not
final
hashCode → int
The hash code for this object.
no setterinherited
inputFormatter → List<TextInputFormatter>?
final
isDense → bool
Whether the InputDecorator.child is part of a dense form (i.e., uses less vertical space).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType → TextInputType
Manage the type of keyboard that shows up
final
length → int
Number of the OTP Fields
final
obscureText → bool
Obscure Text if data is sensitive
final
onChanged → ValueChanged<String>?
Callback function, called when a change is detected to the pin.
final
onCompleted → ValueChanged<String>?
Callback function, called when pin is completed.
final
otpFieldStyle → OtpFieldStyle?
Text Field Style
final
outlineBorderRadius → double
The style to use for the text being edited.
final
redirectFocusToFirstEmptyField → bool
Whether focus should jump to the first empty field when a later field gains focus.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showCursor → bool
Whether to show the cursor and text selection visuals (highlight and selection handles) in the fields.
final
spaceBetween → double
space between the text fields
final
style → TextStyle
The style to use for the text being edited.
final
textCapitalization → TextCapitalization
final
textFieldAlignment → MainAxisAlignment
Text Field Alignment default: MainAxisAlignment.spaceBetween MainAxisAlignment
final
width → double
Total Width of the OTP Text Field
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _OTPTextFieldState
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