mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
[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.
This commit is contained in:
@@ -319,6 +319,36 @@ class BasicTextInputClientState extends State<BasicTextInputClient>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These actions have yet to be implemented for this sample.
|
||||||
|
static final Map<Type, Action<Intent>> _unsupportedActions =
|
||||||
|
<Type, Action<Intent>>{
|
||||||
|
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.
|
/// Keyboard text editing actions.
|
||||||
// The Handling of the default text editing shortcuts with deltas
|
// The Handling of the default text editing shortcuts with deltas
|
||||||
// needs to be in the framework somehow. This should go through some kind of
|
// needs to be in the framework somehow. This should go through some kind of
|
||||||
@@ -348,6 +378,7 @@ class BasicTextInputClientState extends State<BasicTextInputClient>
|
|||||||
DoNothingAndStopPropagationTextIntent: DoNothingAction(
|
DoNothingAndStopPropagationTextIntent: DoNothingAction(
|
||||||
consumesKey: false,
|
consumesKey: false,
|
||||||
),
|
),
|
||||||
|
..._unsupportedActions,
|
||||||
};
|
};
|
||||||
|
|
||||||
void _delete(bool forward) {
|
void _delete(bool forward) {
|
||||||
|
|||||||
Reference in New Issue
Block a user