ShadInputOTP class
A customizable one-time password (OTP) input widget with multiple fields.
The ShadInputOTP widget provides a series of input fields for entering an OTP, managing focus and input across multiple single-character inputs. It integrates with ShadTheme for consistent styling and supports custom formatting and behavior.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ShadInputOTP
- Available extensions
Constructors
-
ShadInputOTP({Key? key, required int maxLength, required List<
Widget> children, bool enabled = true, double? gap, bool jumpToNextWhenFilled = true, ValueChanged<String> ? onChanged, List<TextInputFormatter> ? inputFormatters, TextInputType? keyboardType, String? initialValue}) -
Creates an OTP input widget with the specified number of fields and
children.
const
Properties
-
children
→ List<
Widget> -
The children of the input otp
final
- enabled → bool
-
Whether the input is enabled, defaults to true
final
- gap → double?
-
The gap between each slot, defaults to 8
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialValue → String?
-
The initial value of the OTP, to skip one slot pass an empty space
final
-
inputFormatters
→ List<
TextInputFormatter> ? -
The input formatters for the input of each slot, unless overridden in the
slot
final
- jumpToNextWhenFilled → bool
-
Whether to jump to the next slot when the current slot is filled,
defaults to true
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType?
-
The keyboard type for the input of each slot, unless overridden in the
slot
final
- maxLength → int
-
The maximum length of the OTP
final
-
onChanged
→ ValueChanged<
String> ? -
Called when the value of the OTP changes
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
animate(
{Key? key, List< Effect> ? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) → Animate -
Available on Widget, provided by the AnimateWidgetExtensions extension
Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex.myWidget.animate()is equivalent toAnimate(child: myWidget). -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ShadInputOTP> -
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
-
positionedWith(
ShadPosition position) → Widget -
Available on Widget, provided by the PositionedExt extension
-
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