Docs on TextField disposed by a scrollable (#148149)

Includes docs about the need to manually maintain a TextEditingController when using TextField in a ListView.builder (which was already documented on TextFormField).
This commit is contained in:
Justin McCandless
2024-05-10 16:08:13 -07:00
committed by GitHub
parent 1d6ab6f7a2
commit 3e14f18178

View File

@@ -126,10 +126,15 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
/// disposed.
/// {@endtemplate}
///
/// Remember to call [TextEditingController.dispose] of the [TextEditingController]
/// Remember to call [TextEditingController.dispose] on the [TextEditingController]
/// when it is no longer needed. This will ensure we discard any resources used
/// by the object.
///
/// If this field is part of a scrolling container that lazily constructs its
/// children, like a [ListView] or a [CustomScrollView], then a [controller]
/// should be specified. The controller's lifetime should be managed by a
/// stateful widget ancestor of the scrolling container.
///
/// ## Obscured Input
///
/// {@tool dartpad}