Commit 23174c34 authored by Rubens de Melo's avatar Rubens de Melo Committed by Kate Lovett

Include advice about dispose in TextEditingController api (#33653)

* include advice about dispose

The same note in https://flutter.dev/docs/cookbook/forms/text-field-changes

* Include remember to dispose texteditingcontroller

Almost the same note here https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller .

* include remember to dispose TextEditingController and link to see also

* remove extras spaces and duplicated comment

* include details about using Positioned.fill

* Revert "include details about using Positioned.fill"

This reverts commit c06196f8884d20c547d97edae71d26f7a61701be.

* rever comment about Positioned.fill

* Include of and remove extra white space

Include of and remove extra white space in the end of line

* improve link description to cookbook

///  * Learn how to use a [TextEditingController] in one of our [cookbook recipe]s.(https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller)

* include of, remove extra white space and improve description link to cookbook.

include of, remove extra white space and improve description link to cookbook.

* include of, remove extra white space and improve link description to cookbook

include of, remove extra white space and improve link description to cookbook

* include of, remove extra white space and improve link description to cookbook

include of, remove extra white space and improve link description to cookbook

* remove extra white spaces

* remove extra white space
parent f83df74b
...@@ -117,6 +117,9 @@ enum OverlayVisibilityMode { ...@@ -117,6 +117,9 @@ enum OverlayVisibilityMode {
/// rounded rectangle border around the text field. If you set the [decoration] /// rounded rectangle border around the text field. If you set the [decoration]
/// property to null, the decoration will be removed entirely. /// property to null, the decoration will be removed entirely.
/// ///
/// Remember to [dispose] of the [TextEditingController] when it is no longer needed.
/// This will ensure we discard any resources used by the object.
///
/// See also: /// See also:
/// ///
/// * <https://developer.apple.com/documentation/uikit/uitextfield> /// * <https://developer.apple.com/documentation/uikit/uitextfield>
...@@ -124,6 +127,7 @@ enum OverlayVisibilityMode { ...@@ -124,6 +127,7 @@ enum OverlayVisibilityMode {
/// Design UI conventions. /// Design UI conventions.
/// * [EditableText], which is the raw text editing control at the heart of a /// * [EditableText], which is the raw text editing control at the heart of a
/// [TextField]. /// [TextField].
/// * Learn how to use a [TextEditingController] in one of our [cookbook recipe]s.(https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller)
class CupertinoTextField extends StatefulWidget { class CupertinoTextField extends StatefulWidget {
/// Creates an iOS-style text field. /// Creates an iOS-style text field.
/// ///
......
...@@ -65,6 +65,9 @@ typedef InputCounterWidgetBuilder = Widget Function( ...@@ -65,6 +65,9 @@ typedef InputCounterWidgetBuilder = Widget Function(
/// To integrate the [TextField] into a [Form] with other [FormField] widgets, /// To integrate the [TextField] into a [Form] with other [FormField] widgets,
/// consider using [TextFormField]. /// consider using [TextFormField].
/// ///
/// Remember to [dispose] of the [TextEditingController] when it is no longer needed.
/// This will ensure we discard any resources used by the object.
///
/// {@tool sample} /// {@tool sample}
/// This example shows how to create a [TextField] that will obscure input. The /// This example shows how to create a [TextField] that will obscure input. The
/// [InputDecoration] surrounds the field in a border using [OutlineInputBorder] /// [InputDecoration] surrounds the field in a border using [OutlineInputBorder]
...@@ -91,6 +94,7 @@ typedef InputCounterWidgetBuilder = Widget Function( ...@@ -91,6 +94,7 @@ typedef InputCounterWidgetBuilder = Widget Function(
/// [TextField]. The [EditableText] widget is rarely used directly unless /// [TextField]. The [EditableText] widget is rarely used directly unless
/// you are implementing an entirely different design language, such as /// you are implementing an entirely different design language, such as
/// Cupertino. /// Cupertino.
/// * Learn how to use a [TextEditingController] in one of our [cookbook recipe]s.(https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller)
class TextField extends StatefulWidget { class TextField extends StatefulWidget {
/// Creates a Material Design text field. /// Creates a Material Design text field.
/// ///
......
...@@ -29,6 +29,9 @@ import 'theme.dart'; ...@@ -29,6 +29,9 @@ import 'theme.dart';
/// If a [controller] is not specified, [initialValue] can be used to give /// If a [controller] is not specified, [initialValue] can be used to give
/// the automatically generated controller an initial value. /// the automatically generated controller an initial value.
/// ///
/// Remember to [dispose] of the [TextEditingController] when it is no longer needed.
/// This will ensure we discard any resources used by the object.
///
/// For a documentation about the various parameters, see [TextField]. /// For a documentation about the various parameters, see [TextField].
/// ///
/// {@tool sample} /// {@tool sample}
...@@ -60,6 +63,7 @@ import 'theme.dart'; ...@@ -60,6 +63,7 @@ import 'theme.dart';
/// integration. /// integration.
/// * [InputDecorator], which shows the labels and other visual elements that /// * [InputDecorator], which shows the labels and other visual elements that
/// surround the actual text editing widget. /// surround the actual text editing widget.
/// * Learn how to use a [TextEditingController] in one of our [cookbook recipe]s.(https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller)
class TextFormField extends FormField<String> { class TextFormField extends FormField<String> {
/// Creates a [FormField] that contains a [TextField]. /// Creates a [FormField] that contains a [TextField].
/// ///
......
...@@ -67,6 +67,8 @@ const int _kObscureShowLatestCharCursorTicks = 3; ...@@ -67,6 +67,8 @@ const int _kObscureShowLatestCharCursorTicks = 3;
/// added to this controller. If both properties need to be changed then the /// added to this controller. If both properties need to be changed then the
/// controller's [value] should be set instead. /// controller's [value] should be set instead.
/// ///
/// Remember to [dispose] of the [TextEditingController] when it is no longer needed.
/// This will ensure we discard any resources used by the object.
/// {@tool snippet --template=stateful_widget_material} /// {@tool snippet --template=stateful_widget_material}
/// This example creates a [TextField] with a [TextEditingController] whose /// This example creates a [TextField] with a [TextEditingController] whose
/// change listener forces the entered text to be lower case and keeps the /// change listener forces the entered text to be lower case and keeps the
...@@ -113,6 +115,7 @@ const int _kObscureShowLatestCharCursorTicks = 3; ...@@ -113,6 +115,7 @@ const int _kObscureShowLatestCharCursorTicks = 3;
/// with a [TextEditingController]. /// with a [TextEditingController].
/// * [EditableText], which is a raw region of editable text that can be /// * [EditableText], which is a raw region of editable text that can be
/// controlled with a [TextEditingController]. /// controlled with a [TextEditingController].
/// * Learn how to use a [TextEditingController] in one of our [cookbook recipe]s.(https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller)
class TextEditingController extends ValueNotifier<TextEditingValue> { class TextEditingController extends ValueNotifier<TextEditingValue> {
/// Creates a controller for an editable text field. /// Creates a controller for an editable text field.
/// ///
......
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