From 136e3cb273659120ee5a33c3c4f2db14c3a97ef4 Mon Sep 17 00:00:00 2001 From: Renzo Olivares Date: Wed, 28 Jun 2023 18:42:25 -0700 Subject: [PATCH] [Simplistic_Editor] Add list of unsupported intents (#1927) Adds a list of unsupported actions to prevent an error that is fired when there is an unmapped intent to action. `Unable to find an action for an Intent with type NameOfIntent in an Actions widget in the given context.` Fixes #1693 ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] All existing and new tests are passing. --- .../lib/basic_text_input_client.dart | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/simplistic_editor/lib/basic_text_input_client.dart b/simplistic_editor/lib/basic_text_input_client.dart index 9a9954a33..4605c783a 100644 --- a/simplistic_editor/lib/basic_text_input_client.dart +++ b/simplistic_editor/lib/basic_text_input_client.dart @@ -319,6 +319,36 @@ class BasicTextInputClientState extends State }); } + // These actions have yet to be implemented for this sample. + static final Map> _unsupportedActions = + >{ + DeleteToNextWordBoundaryIntent: DoNothingAction(consumesKey: false), + DeleteToLineBreakIntent: DoNothingAction(consumesKey: false), + ExtendSelectionToNextWordBoundaryIntent: + DoNothingAction(consumesKey: false), + ExtendSelectionToNextParagraphBoundaryOrCaretLocationIntent: + DoNothingAction(consumesKey: false), + ExtendSelectionToLineBreakIntent: DoNothingAction(consumesKey: false), + ExtendSelectionVerticallyToAdjacentLineIntent: + DoNothingAction(consumesKey: false), + ExtendSelectionVerticallyToAdjacentPageIntent: + DoNothingAction(consumesKey: false), + ExtendSelectionToNextParagraphBoundaryIntent: + DoNothingAction(consumesKey: false), + ExtendSelectionToDocumentBoundaryIntent: + DoNothingAction(consumesKey: false), + ExtendSelectionByPageIntent: DoNothingAction(consumesKey: false), + ExpandSelectionToDocumentBoundaryIntent: + DoNothingAction(consumesKey: false), + ExpandSelectionToLineBreakIntent: DoNothingAction(consumesKey: false), + ScrollToDocumentBoundaryIntent: DoNothingAction(consumesKey: false), + RedoTextIntent: DoNothingAction(consumesKey: false), + ReplaceTextIntent: DoNothingAction(consumesKey: false), + UndoTextIntent: DoNothingAction(consumesKey: false), + UpdateSelectionIntent: DoNothingAction(consumesKey: false), + TransposeCharactersIntent: DoNothingAction(consumesKey: false), + }; + /// Keyboard text editing actions. // The Handling of the default text editing shortcuts with deltas // needs to be in the framework somehow. This should go through some kind of @@ -348,6 +378,7 @@ class BasicTextInputClientState extends State DoNothingAndStopPropagationTextIntent: DoNothingAction( consumesKey: false, ), + ..._unsupportedActions, }; void _delete(bool forward) {