From 1178c8e9d32890b253f5ca83c8c762f4c3d12cb2 Mon Sep 17 00:00:00 2001 From: chunhtai <47866232+chunhtai@users.noreply.github.com> Date: Wed, 23 Feb 2022 09:48:53 -0800 Subject: [PATCH] Revert "Remove redundant hide handles API from TextSelectionDelegate (#98944)" (#99008) This reverts commit 94f6fd6ea8934407452853405835b92fec0d7ad9. --- packages/flutter/lib/src/services/text_input.dart | 7 +++++++ packages/flutter/lib/src/widgets/editable_text.dart | 6 +----- packages/flutter/test/rendering/editable_test.dart | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index d4906646f6..7bf468ab60 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -990,6 +990,13 @@ mixin TextSelectionDelegate { /// updating the text editing state. void userUpdateTextEditingValue(TextEditingValue value, SelectionChangedCause cause); + /// Hides the text selection toolbar. + /// + /// By default, hideHandles is true, and the toolbar is hidden along with its + /// handles. If hideHandles is set to false, then the toolbar will be hidden + /// but the handles will remain. + void hideToolbar([bool hideHandles = true]); + /// Brings the provided [TextPosition] into the visible area of the text /// input. void bringIntoView(TextPosition position); diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index b2de252c9e..22ebcf4ca5 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -2908,11 +2908,7 @@ class EditableTextState extends State with AutomaticKeepAliveClien return true; } - /// Hides the text selection toolbar. - /// - /// By default, hideHandles is true, and the toolbar is hidden along with its - /// handles. If hideHandles is set to false, then the toolbar will be hidden - /// but the handles will remain. + @override void hideToolbar([bool hideHandles = true]) { if (hideHandles) { // Hide the handles and the toolbar. diff --git a/packages/flutter/test/rendering/editable_test.dart b/packages/flutter/test/rendering/editable_test.dart index 4134bc103d..377c343e42 100644 --- a/packages/flutter/test/rendering/editable_test.dart +++ b/packages/flutter/test/rendering/editable_test.dart @@ -27,6 +27,9 @@ class _FakeEditableTextState with TextSelectionDelegate { @override TextEditingValue textEditingValue = TextEditingValue.empty; + @override + void hideToolbar([bool hideHandles = true]) { } + @override void userUpdateTextEditingValue(TextEditingValue value, SelectionChangedCause cause) { }