Unverified Commit e047fe7f authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Improve documentation of `EditableText`/`TextField` callbacks (#98414)

parent 09c7eb1b
...@@ -184,6 +184,8 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete ...@@ -184,6 +184,8 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
/// ** See code in examples/api/lib/material/text_field/text_field.1.dart ** /// ** See code in examples/api/lib/material/text_field/text_field.1.dart **
/// {@end-tool} /// {@end-tool}
/// ///
/// {@macro flutter.widgets.EditableText.lifeCycle}
///
/// For most applications the [onSubmitted] callback will be sufficient for /// For most applications the [onSubmitted] callback will be sufficient for
/// reacting to user input. /// reacting to user input.
/// ///
......
...@@ -335,6 +335,7 @@ class ToolbarOptions { ...@@ -335,6 +335,7 @@ class ToolbarOptions {
/// [textInputAction]s can be chosen by checking the current platform and then /// [textInputAction]s can be chosen by checking the current platform and then
/// selecting the appropriate action. /// selecting the appropriate action.
/// ///
/// {@template flutter.widgets.EditableText.lifeCycle}
/// ## Lifecycle /// ## Lifecycle
/// ///
/// Upon completion of editing, like pressing the "done" button on the keyboard, /// Upon completion of editing, like pressing the "done" button on the keyboard,
...@@ -352,6 +353,7 @@ class ToolbarOptions { ...@@ -352,6 +353,7 @@ class ToolbarOptions {
/// When the widget has focus, it will prevent itself from disposing via /// When the widget has focus, it will prevent itself from disposing via
/// [AutomaticKeepAliveClientMixin.wantKeepAlive] in order to avoid losing the /// [AutomaticKeepAliveClientMixin.wantKeepAlive] in order to avoid losing the
/// selection. Removing the focus will allow it to be disposed. /// selection. Removing the focus will allow it to be disposed.
/// {@endtemplate}
/// ///
/// Rather than using this widget directly, consider using [TextField], which /// Rather than using this widget directly, consider using [TextField], which
/// is a full-featured, material-design text input field with placeholder text, /// is a full-featured, material-design text input field with placeholder text,
...@@ -1006,6 +1008,10 @@ class EditableText extends StatefulWidget { ...@@ -1006,6 +1008,10 @@ class EditableText extends StatefulWidget {
/// and selection, one can add a listener to its [controller] with /// and selection, one can add a listener to its [controller] with
/// [TextEditingController.addListener]. /// [TextEditingController.addListener].
/// ///
/// [onChanged] is called before [onSubmitted] when user indicates completion
/// of editing, such as when pressing the "done" button on the keyboard. That default
/// behavior can be overridden. See [onEditingComplete] for details.
///
/// {@tool dartpad} /// {@tool dartpad}
/// This example shows how onChanged could be used to check the TextField's /// This example shows how onChanged could be used to check the TextField's
/// current value each time the user inserts or deletes a character. /// current value each time the user inserts or deletes a character.
...@@ -1061,6 +1067,10 @@ class EditableText extends StatefulWidget { ...@@ -1061,6 +1067,10 @@ class EditableText extends StatefulWidget {
/// {@template flutter.widgets.editableText.onSubmitted} /// {@template flutter.widgets.editableText.onSubmitted}
/// Called when the user indicates that they are done editing the text in the /// Called when the user indicates that they are done editing the text in the
/// field. /// field.
///
/// By default, [onSubmitted] is called after [onChanged] when the user
/// has finalized editing; or, if the default behavior has been overridden,
/// after [onEditingComplete]. See [onEditingComplete] for details.
/// {@endtemplate} /// {@endtemplate}
final ValueChanged<String>? onSubmitted; final ValueChanged<String>? onSubmitted;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment