From 62cb61d3f36674952a8345a54e723eb663d3cfdb Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Thu, 13 Apr 2023 10:13:13 -0700 Subject: [PATCH] Improve the docs around the TextSelectionHandleControls deprecations (#123827) Explain how to do the two-step migration to the context menus feature. --- .../flutter/lib/src/widgets/text_selection.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart index 58a419f540..3b88b5ac99 100644 --- a/packages/flutter/lib/src/widgets/text_selection.dart +++ b/packages/flutter/lib/src/widgets/text_selection.dart @@ -64,6 +64,22 @@ class ToolbarItemsParentData extends ContainerBoxParentData { /// /// Override text operations such as [handleCut] if needed. /// +/// ## Use with [EditableText.contextMenuBuilder] +/// [buildToolbar] has been deprecated in favor of +/// [EditableText.contextMenuBuilder], and that is the preferred way to +/// customize the context menus now. However, both ways will continue to work +/// during the deprecation period. +/// +/// To use both [EditableText.contextMenuBuilder] and [buildHandle], a two-step +/// migration is necessary. First, migrate to [TextSelectionHandleControls], +/// using its [TextSelectionHandleControls.buildHandle] method and moving +/// toolbar code to [EditableText.contextMenuBuilder]. Later, the deprecation +/// period will expire, [buildToolbar] will be removed, and +/// [TextSelectionHandleControls] will be deprecated. Migrate back to +/// [TextSelectionControls.buildHandle], so that the final state is to use +/// [EditableText.contextMenuBuilder] for the toolbar and +/// [TextSelectionControls] for the handles. +/// /// See also: /// /// * [SelectionArea], which selects appropriate text selection controls