DesignOtpField class
A one-time code drawn as boxes over one input.
DesignOtpField(length: 4, slotBuilder: (context, slot) => Text(slot.character))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DesignOtpField
Constructors
-
DesignOtpField({Key? key, required DesignOtpSlotBuilder slotBuilder, int length = 6, DesignOtpController? controller, FocusNode? focusNode, DesignOtpLayoutBuilder? layoutBuilder, ValueChanged<
String> ? onChanged, ValueChanged<String> ? onCompleted, bool autofocus = false, bool enabled = true, bool isError = false, bool obscureText = false, TextInputType keyboardType = TextInputType.number, TextDirection textDirection = TextDirection.ltr, String? semanticLabel = 'One-time code', TextInputAction? textInputAction, VoidCallback? onEditingComplete, DesignOtpContextMenuBuilder? contextMenuBuilder, ValueChanged<String> ? onSubmitted, List<TextInputFormatter> inputFormatters = const [], Iterable<String> autofillHints = const [AutofillHints.oneTimeCode]}) -
A code field of
lengthboxes.const
Properties
-
autofillHints
→ Iterable<
String> -
What autofill may offer; a one-time code by default.
final
- autofocus → bool
-
Whether it takes focus when it first appears, as Focus.autofocus
does: one part on a route asks for it.
final
- contextMenuBuilder → DesignOtpContextMenuBuilder?
-
Draws the menu a long press or a secondary click opens, offering Paste
while the clipboard holds text; null offers none.
final
- controller → DesignOtpController?
-
Holds the code, when the caller does. The caller disposes it; null:
the field makes its own and disposes it.
final
- enabled → bool
-
Whether it takes input.
final
- focusNode → FocusNode?
-
The input's focus.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputFormatters
→ List<
TextInputFormatter> -
The caller's formatters (upper-casing letters, say), run before the
code's own filter and length, which have the last word: nothing the
code does not allow gets through.
final
- isError → bool
-
Whether the code is wrong.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType
-
The keyboard the platform shows.
final
- layoutBuilder → DesignOtpLayoutBuilder?
-
Lays out the boxes; null puts them in a row.
final
- length → int
-
How many boxes; ignored when controller is given (its length wins).
final
- obscureText → bool
-
Whether the characters are hidden (a PIN).
final
-
onChanged
→ ValueChanged<
String> ? -
Called with the code as it changes.
final
-
onCompleted
→ ValueChanged<
String> ? -
Called once each time the code becomes whole.
final
- onEditingComplete → VoidCallback?
-
Called when the action key is pressed; null: the input lets go of the
focus, as any one-line input does.
final
-
onSubmitted
→ ValueChanged<
String> ? -
Called with the code when the action key is pressed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
What a screen reader calls it, as given (pass it in the app's
language). The length is not added to it: the node carries it as its
maximum length, which the platform reads out in the user's language.
Null gives the input no name of its own, for a caller whose own
semantics (a form field's) name it; so, unlike the other behaviours'
words, its default is English here rather than
DesignLocalizations'.final - slotBuilder → DesignOtpSlotBuilder
-
Paints one box.
final
- textDirection → TextDirection
-
The boxes' order: left to right, as codes are read, even in right to
left text.
final
- textInputAction → TextInputAction?
-
The keyboard's action key; null: the platform's for one line (done).
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DesignOtpField> -
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.
override
-
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