You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs on the interaction between Shortcuts and text input (#144328)
I was talking with @tvolkert about the complex behavior of Shortcuts when a text field is focused. I created [this dartpad](https://dartpad.dev/?id=0b5c08fa85637422baa84927b7f1ee5f) to illustrate the problem, which shows a key being stolen from a text field by Shortcuts, and how to prevent that using DoNothingAndStopPropagationIntent.
This PR adds a section in the docs explaining how all of this works and how to override this "stealing" problem.
Copy file name to clipboardExpand all lines: packages/flutter/lib/src/widgets/editable_text.dart
+38-3Lines changed: 38 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -631,9 +631,10 @@ class _DiscreteKeyFrameSimulation extends Simulation {
631
631
/// This widget provides default [Action]s for handling common text editing
632
632
/// [Intent]s such as deleting, copying and pasting in the text field. These
633
633
/// [Action]s can be directly invoked using [Actions.invoke] or the
634
-
/// [Actions.maybeInvoke] method. The default text editing keyboard [Shortcuts]
635
-
/// also use these [Intent]s and [Action]s to perform the text editing
636
-
/// operations they are bound to.
634
+
/// [Actions.maybeInvoke] method. The default text editing keyboard [Shortcuts],
635
+
/// typically declared in [DefaultTextEditingShortcuts], also use these
636
+
/// [Intent]s and [Action]s to perform the text editing operations they are
637
+
/// bound to.
637
638
///
638
639
/// The default handling of a specific [Intent] can be overridden by placing an
639
640
/// [Actions] widget above this widget. See the [Action] class and the
@@ -683,6 +684,40 @@ class _DiscreteKeyFrameSimulation extends Simulation {
683
684
/// | [CopySelectionTextIntent] | Copies or cuts the selected text into the clipboard |
684
685
/// | [PasteTextIntent] | Inserts the current text in the clipboard after the caret location, or replaces the selected text if the selection is not collapsed. |
685
686
///
687
+
/// ## Text Editing [Shortcuts]
688
+
///
689
+
/// It's also possible to directly remap keyboard shortcuts to new [Intent]s by
690
+
/// inserting a [Shortcuts] widget above this in the widget tree. When using
691
+
/// [WidgetsApp], the large set of default text editing keyboard shortcuts are
692
+
/// declared near the top of the widget tree in [DefaultTextEditingShortcuts],
693
+
/// and any [Shortcuts] widget between it and this [EditableText] will override
0 commit comments