FormPinField<TValue> class
Widget for Pin text field for forms.
Place under the Form that gave FormController.key, or pass FormController to form.
When FormController is passed to form, onSaved must also be passed together. The contents of onSaved will be used to save the data.
Enter the initial value given by FormController.value in initialValue.
Each time the content is changed, onChanged
is executed.
When FormController.validate is executed, validation and data saving are performed.
Only when emptyErrorText
is specified, emptyErrorText
will be displayed as an error if no characters are entered.
Only when lengthErrorText
is specified, if the number of characters entered is less than minLength
, it is displayed as lengthErrorText
.
Other error checking is performed by specifying validator. If a string other than Null is returned in the callback, the string is displayed as an error statement. If Null is returned, it is processed as no error.
The onSubmitted
process is executed when the Enter key or other keys are pressed.
If enabled is false
, the text is deactivated.
If readOnly is set to true
, the activation is displayed, but the text cannot be changed.
If obscureText
is set to true
, the input string will be hidden. Please use this function for inputting passwords, etc.
If inputFormatters
is specified, it is possible to restrict the characters to be entered.
フォーム用のPinテキストフィールド用のウィジェット。
FormController.keyを与えたForm配下に配置、もしくはformにFormControllerを渡します。
formにFormControllerを渡した場合、一緒にonSavedも渡してください。データの保存はonSavedの内容が実行されます。
initialValueにFormController.valueから与えられた初期値を入力します。
内容が変更される度onChanged
が実行されます。
FormController.validateが実行された場合、バリデーションとデータの保存を行ないます。
emptyErrorText
が指定されている時に限り、文字が入力されていない場合emptyErrorText
がエラーとして表示されます。
lengthErrorText
が指定されている時に限り、minLength
より入力された文字数が少ない場合lengthErrorText
として表示されます。
それ以外のエラーチェックはvalidatorを指定することで行ないます。 コールバック内でNull以外を返すようにするとその文字列がエラー文として表示されます。Nullの場合はエラーなしとして処理されます。
Enterキーなどが押された場合の処理をonSubmitted
が実行されます。
enabledがfalse
になるとテキストが非有効化されます。
readOnlyがtrue
になっている場合は、有効化の表示になりますが、テキストが変更できなくなります。
obscureText
がtrue
になると入力された文字列が隠されます。パスワードの入力などにご利用ください。
inputFormatters
が指定されると入力される文字を制限することが可能です。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FormField<
String> - FormPinField
- Available Extensions
Constructors
-
FormPinField({Key? key, bool keepAlive = true, int maxLength = kPinLength, int? minLength, FormController<
TValue> ? form, TextEditingController? controller, FormStyle? style, bool enabled = true, String? initialValue, FocusNode? focusNode, TextInputType keyboardType = TextInputType.phone, TextInputAction textInputAction = TextInputAction.done, List<TextInputFormatter> ? inputFormatters, bool autocorrect = false, bool enableInteractiveSelection = false, bool readOnly = false, Iterable<String> ? autofillHints, Cursor? mouseCursor, TextCapitalization textCapitalization = TextCapitalization.none, ValueChanged<String> ? onChanged, ValueChanged<String> ? onSubmitted, String? emptyErrorText, String? lengthErrorText, String? validator(String? value)?, TValue onSaved(String value)?, String? hintText, bool obscureText = false, bool autofocus = false}) - Widget for Pin text field for forms.
Properties
- autofocus → bool
-
If
true
, focus is automatically applied.final - autovalidateMode → AutovalidateMode
-
Used to enable/disable this form field auto validation and update its
error text.
finalinherited
-
builder
→ FormFieldBuilder<
String> -
Function that returns the widget representing this form field. It is
passed the form field state as input, containing the current value and
validation state of this field.
finalinherited
- controller → TextEditingController?
-
Controller for text forms.
final
- enabled → bool
-
Whether the form is able to receive user input.
finalinherited
- focusNode → FocusNode?
-
Specifies the focus node.
final
-
form
→ FormController<
TValue> ? -
Context for forms.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialValue → String?
-
An optional value to initialize the form field to, or null otherwise.
finalinherited
- keepAlive → bool
-
If placed in a list, whether or not it should not be discarded on scrolling.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onSaved
→ FormFieldSetter<
String> ? -
An optional method to call with the final value when the form is saved via
FormState.save.
finalinherited
- readOnly → bool
-
If this is
true
, the form cannot be filled out and changed from its initial value.final - restorationId → String?
-
Restoration ID to save and restore the state of the form field.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → FormStyle?
-
Form Style.
final
-
validator
→ FormFieldValidator<
String> ? -
An optional method that validates an input. Returns an error string to
display if the input is invalid, or null otherwise.
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → FormFieldState< String> -
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}) → 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