FormFutureField<T extends Object, TValue> class

A form that waits for another process to complete and updates the value of the form based on that value.

Use this when moving to another page and updating form values based on values entered on that page, or updating form values based on API responses.

Specifying onTap describes the data acquisition process after a tap.

You can freely change the display by passing a widget with builder. If builder is not passed, a TextField will be displayed. In that case, you can use parseToString to convert the value of T to a string.

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.

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.

If enabled is false, the text is deactivated.

If readOnly is set to true, the activation is displayed, but the text cannot be changed.

別の処理の完了を待ってその値を元にフォームの値を更新するフォーム。

別のページに遷移してそのページで入力した値を元にフォームの値を更新する場合やAPIのレスポンスを元にフォームの値を更新する場合に使用します。

onTapを指定することでタップした後のデータ取得処理を記述します。

builderでウィジェットを渡すことで自由に表示を変更できます。builderが渡されない場合はTextFieldが表示されます。その際parseToStringTの値を文字列に変換することが可能です。

FormController.keyを与えたForm配下に配置、もしくはformFormControllerを渡します。

formFormControllerを渡した場合、一緒にonSavedも渡してください。データの保存はonSavedの内容が実行されます。

initialValueFormController.valueから与えられた初期値を入力します。

内容が変更される度onChangedが実行されます。

FormController.validateが実行された場合、バリデーションとデータの保存を行ないます。

emptyErrorTextが指定されている時に限り、文字が入力されていない場合emptyErrorTextがエラーとして表示されます。

それ以外のエラーチェックはvalidatorを指定することで行ないます。 コールバック内でNull以外を返すようにするとその文字列がエラー文として表示されます。Nullの場合はエラーなしとして処理されます。

enabledfalseになるとテキストが非有効化されます。

readOnlytrueになっている場合は、有効化の表示になりますが、テキストが変更できなくなります。

Inheritance
Available Extensions

Constructors

FormFutureField({FormController<TValue>? form, FormStyle? style, required FutureOr<T?> onTap(T? currentValue), Widget builder(BuildContext context, FormFutureFieldRef<T, TValue> value)?, String parseToString(T? value)?, FormAffixStyle? prefix, FormAffixStyle? suffix, bool obscureText = false, String? hintText, bool readOnly = false, String? labelText, void onChanged(T? value)?, String? emptyErrorText, bool keepAlive = true, bool showDropdownIcon = true, Widget? dropdownIcon, Key? key, TValue onSaved(T value)?, String? validator(T? value)?, T? initialValue, bool enabled = true})
A form that waits for another process to complete and updates the value of the form based on that value.

Properties

autovalidateMode AutovalidateMode
Used to enable/disable this form field auto validation and update its error text.
finalinherited
builder FormFieldBuilder<T>
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
Icon for dropdown. Valid only if showDropdownIcon is true.
final
emptyErrorText String?
Error text. Only displayed if the object entered is missing.
final
enabled bool
Whether the form is able to receive user input.
finalinherited
form FormController<TValue>?
Context for forms.
final
hashCode int
The hash code for this object.
no setterinherited
hintText String?
Hint to be displayed on the form. Displayed when no text is entered.
final
initialValue → T?
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
labelText String?
Label text for forms.
final
obscureText bool
If this is true, the input will be hidden. Use this to enter passwords, etc.
final
onChanged → (void Function(T? value)?)
Callback to be executed each time the value is changed.
final
onSaved FormFieldSetter<T>?
An optional method to call with the final value when the form is saved via FormState.save.
finalinherited
onTap FutureOr<T?> Function(T? currentValue)
Describe the behavior when the form is tapped.
final
parseToString → (String Function(T? value)?)
Describe the data acquisition process after a tap.
final
prefix FormAffixStyle?
A widget that is placed in front of the form.
final
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
showDropdownIcon bool
true` if you want to display icons for drop-downs.
final
style FormStyle?
Form Style.
final
suffix FormAffixStyle?
A widget that is placed after the form.
final
validator FormFieldValidator<T>?
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<T>
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