Support block delete with word and line modifiers (#77172)
This commit is contained in:
parent
2369d76a1d
commit
75453e6ac6
@ -670,10 +670,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
// _handleShortcuts depends on being started in the same stack invocation
|
// _handleShortcuts depends on being started in the same stack invocation
|
||||||
// as the _handleKeyEvent method
|
// as the _handleKeyEvent method
|
||||||
_handleShortcuts(key);
|
_handleShortcuts(key);
|
||||||
} else if (key == LogicalKeyboardKey.delete) {
|
|
||||||
_handleDelete(forward: true);
|
|
||||||
} else if (key == LogicalKeyboardKey.backspace) {
|
|
||||||
_handleDelete(forward: false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,16 +1011,381 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
return _getTextPositionVertical(offset, verticalOffset);
|
return _getTextPositionVertical(offset, verticalOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deletes the current uncollapsed selection.
|
||||||
|
void _deleteSelection(TextSelection selection, SelectionChangedCause cause) {
|
||||||
|
assert(selection.isCollapsed == false);
|
||||||
|
|
||||||
|
if (_readOnly || !selection.isValid || selection.isCollapsed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
final String textBefore = selection.textBefore(text);
|
||||||
|
final String textAfter = selection.textAfter(text);
|
||||||
|
final int cursorPosition = math.min(selection.start, selection.end);
|
||||||
|
|
||||||
|
final TextSelection newSelection = TextSelection.collapsed(offset: cursorPosition);
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: newSelection),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deletes the from the current collapsed selection to the start of the field.
|
||||||
|
//
|
||||||
|
// The given SelectionChangedCause indicates the cause of this change and
|
||||||
|
// will be passed to onSelectionChanged.
|
||||||
|
//
|
||||||
|
// See also:
|
||||||
|
// * _deleteToEnd
|
||||||
|
void _deleteToStart(TextSelection selection, SelectionChangedCause cause) {
|
||||||
|
assert(selection.isCollapsed);
|
||||||
|
|
||||||
|
if (_readOnly || !selection.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
final String textBefore = selection.textBefore(text);
|
||||||
|
|
||||||
|
if (textBefore.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String textAfter = selection.textAfter(text);
|
||||||
|
const TextSelection newSelection = TextSelection.collapsed(offset: 0);
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textAfter, selection: newSelection),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deletes the from the current collapsed selection to the end of the field.
|
||||||
|
//
|
||||||
|
// The given SelectionChangedCause indicates the cause of this change and
|
||||||
|
// will be passed to onSelectionChanged.
|
||||||
|
//
|
||||||
|
// See also:
|
||||||
|
// * _deleteToStart
|
||||||
|
void _deleteToEnd(TextSelection selection, SelectionChangedCause cause) {
|
||||||
|
assert(selection.isCollapsed);
|
||||||
|
|
||||||
|
if (_readOnly || !selection.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
final String textAfter = selection.textAfter(text);
|
||||||
|
|
||||||
|
if (textAfter.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String textBefore = selection.textBefore(text);
|
||||||
|
final TextSelection newSelection = TextSelection.collapsed(offset: textBefore.length);
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore, selection: newSelection),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes backwards from the current selection.
|
||||||
|
///
|
||||||
|
/// If the [selection] is collapsed, deletes a single character before the
|
||||||
|
/// cursor.
|
||||||
|
///
|
||||||
|
/// If the [selection] is not collapsed, deletes the selection.
|
||||||
|
///
|
||||||
|
/// {@template flutter.rendering.RenderEditable.cause}
|
||||||
|
/// The given [SelectionChangedCause] indicates the cause of this change and
|
||||||
|
/// will be passed to [onSelectionChanged].
|
||||||
|
/// {@endtemplate}
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [deleteForward], which is same but in the opposite direction.
|
||||||
|
void delete(SelectionChangedCause cause) {
|
||||||
|
assert(_selection != null);
|
||||||
|
|
||||||
|
if (_readOnly || !_selection!.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_selection!.isCollapsed) {
|
||||||
|
return _deleteSelection(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
String textBefore = _selection!.textBefore(text);
|
||||||
|
if (textBefore.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int characterBoundary = previousCharacter(textBefore.length, textBefore);
|
||||||
|
textBefore = textBefore.substring(0, characterBoundary);
|
||||||
|
|
||||||
|
final String textAfter = _selection!.textAfter(text);
|
||||||
|
final TextSelection newSelection = TextSelection.collapsed(offset: characterBoundary);
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: newSelection),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes a word backwards from the current selection.
|
||||||
|
///
|
||||||
|
/// If the [selection] is collapsed, deletes a word before the cursor.
|
||||||
|
///
|
||||||
|
/// If the [selection] is not collapsed, deletes the selection.
|
||||||
|
///
|
||||||
|
/// If [obscureText] is true, it treats the whole text content as
|
||||||
|
/// a single word.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
|
///
|
||||||
|
/// {@template flutter.rendering.RenderEditable.whiteSpace}
|
||||||
|
/// By default, includeWhitespace is set to true, meaning that whitespace can
|
||||||
|
/// be considered a word in itself. If set to false, the selection will be
|
||||||
|
/// extended past any whitespace and the first word following the whitespace.
|
||||||
|
/// {@endtemplate}
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [deleteForwardByWord], which is same but in the opposite direction.
|
||||||
|
void deleteByWord(SelectionChangedCause cause, [bool includeWhitespace = true]) {
|
||||||
|
assert(_selection != null);
|
||||||
|
|
||||||
|
if (_readOnly || !_selection!.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_selection!.isCollapsed) {
|
||||||
|
return _deleteSelection(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the text is obscured, the whole thing is treated as one big line.
|
||||||
|
if (obscureText) {
|
||||||
|
return _deleteToStart(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
String textBefore = _selection!.textBefore(text);
|
||||||
|
if (textBefore.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int characterBoundary = _getLeftByWord(_textPainter, textBefore.length, includeWhitespace);
|
||||||
|
textBefore = textBefore.trimRight().substring(0, characterBoundary);
|
||||||
|
|
||||||
|
final String textAfter = _selection!.textAfter(text);
|
||||||
|
final TextSelection newSelection = TextSelection.collapsed(offset: characterBoundary);
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: newSelection),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes a line backwards from the current selection.
|
||||||
|
///
|
||||||
|
/// If the [selection] is collapsed, deletes a line before the cursor.
|
||||||
|
///
|
||||||
|
/// If the [selection] is not collapsed, deletes the selection.
|
||||||
|
///
|
||||||
|
/// If [obscureText] is true, it treats the whole text content as
|
||||||
|
/// a single word.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [deleteForwardByLine], which is same but in the opposite direction.
|
||||||
|
void deleteByLine(SelectionChangedCause cause) {
|
||||||
|
assert(_selection != null);
|
||||||
|
|
||||||
|
if (_readOnly || !_selection!.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_selection!.isCollapsed) {
|
||||||
|
return _deleteSelection(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the text is obscured, the whole thing is treated as one big line.
|
||||||
|
if (obscureText) {
|
||||||
|
return _deleteToStart(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
String textBefore = _selection!.textBefore(text);
|
||||||
|
if (textBefore.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When there is a line break, line delete shouldn't do anything
|
||||||
|
final bool isPreviousCharacterBreakLine = textBefore.codeUnitAt(textBefore.length - 1) == 0x0A;
|
||||||
|
if (isPreviousCharacterBreakLine) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TextSelection line = _getLineAtOffset(TextPosition(offset: textBefore.length - 1));
|
||||||
|
textBefore = textBefore.substring(0, line.start);
|
||||||
|
|
||||||
|
final String textAfter = _selection!.textAfter(text);
|
||||||
|
final TextSelection newSelection = TextSelection.collapsed(offset: textBefore.length);
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: newSelection),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes in the foward direction from the current selection.
|
||||||
|
///
|
||||||
|
/// If the [selection] is collapsed, deletes a single character after the
|
||||||
|
/// cursor.
|
||||||
|
///
|
||||||
|
/// If the [selection] is not collapsed, deletes the selection.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [delete], which is same but in the opposite direction.
|
||||||
|
void deleteForward(SelectionChangedCause cause) {
|
||||||
|
assert(_selection != null);
|
||||||
|
|
||||||
|
if (_readOnly || !_selection!.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_selection!.isCollapsed) {
|
||||||
|
return _deleteSelection(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
final String textBefore = _selection!.textBefore(text);
|
||||||
|
String textAfter = _selection!.textAfter(text);
|
||||||
|
|
||||||
|
if (textAfter.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int deleteCount = nextCharacter(0, textAfter);
|
||||||
|
textAfter = textAfter.substring(deleteCount);
|
||||||
|
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: _selection!),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes a word in the foward direction from the current selection.
|
||||||
|
///
|
||||||
|
/// If the [selection] is collapsed, deletes a word after the cursor.
|
||||||
|
///
|
||||||
|
/// If the [selection] is not collapsed, deletes the selection.
|
||||||
|
///
|
||||||
|
/// If [obscureText] is true, it treats the whole text content as
|
||||||
|
/// a single word.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
|
///
|
||||||
|
/// {@macro flutter.rendering.RenderEditable.whiteSpace}
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [deleteByWord], which is same but in the opposite direction.
|
||||||
|
void deleteForwardByWord(SelectionChangedCause cause, [bool includeWhitespace = true]) {
|
||||||
|
assert(_selection != null);
|
||||||
|
|
||||||
|
if (_readOnly || !_selection!.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_selection!.isCollapsed) {
|
||||||
|
return _deleteSelection(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the text is obscured, the whole thing is treated as one big word.
|
||||||
|
if (obscureText) {
|
||||||
|
return _deleteToEnd(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
String textAfter = _selection!.textAfter(text);
|
||||||
|
|
||||||
|
if (textAfter.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String textBefore = _selection!.textBefore(text);
|
||||||
|
final int characterBoundary = _getRightByWord(_textPainter, textBefore.length, includeWhitespace);
|
||||||
|
textAfter = textAfter.substring(characterBoundary - textBefore.length);
|
||||||
|
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: _selection!),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes a line in the foward direction from the current selection.
|
||||||
|
///
|
||||||
|
/// If the [selection] is collapsed, deletes a line after the cursor.
|
||||||
|
///
|
||||||
|
/// If the [selection] is not collapsed, deletes the selection.
|
||||||
|
///
|
||||||
|
/// If [obscureText] is true, it treats the whole text content as
|
||||||
|
/// a single word.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
|
///
|
||||||
|
/// See also:
|
||||||
|
///
|
||||||
|
/// * [deleteByLine], which is same but in the opposite direction.
|
||||||
|
void deleteForwardByLine(SelectionChangedCause cause) {
|
||||||
|
assert(_selection != null);
|
||||||
|
|
||||||
|
if (_readOnly || !_selection!.isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_selection!.isCollapsed) {
|
||||||
|
return _deleteSelection(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the text is obscured, the whole thing is treated as one big line.
|
||||||
|
if (obscureText) {
|
||||||
|
return _deleteToEnd(_selection!, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = textSelectionDelegate.textEditingValue.text;
|
||||||
|
String textAfter = _selection!.textAfter(text);
|
||||||
|
if (textAfter.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When there is a line break, it shouldn't do anything.
|
||||||
|
final bool isNextCharacterBreakLine = textAfter.codeUnitAt(0) == 0x0A;
|
||||||
|
if (isNextCharacterBreakLine) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String textBefore = _selection!.textBefore(text);
|
||||||
|
final TextSelection line = _getLineAtOffset(TextPosition(offset: textBefore.length));
|
||||||
|
textAfter = textAfter.substring(line.end - textBefore.length, textAfter.length);
|
||||||
|
|
||||||
|
_setTextEditingValue(
|
||||||
|
TextEditingValue(text: textBefore + textAfter, selection: _selection!),
|
||||||
|
cause,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Keeping [selection]'s [TextSelection.baseOffset] fixed, move the
|
/// Keeping [selection]'s [TextSelection.baseOffset] fixed, move the
|
||||||
/// [TextSelection.extentOffset] down by one line.
|
/// [TextSelection.extentOffset] down by one line.
|
||||||
///
|
///
|
||||||
/// If [selectionEnabled] is false, keeps the selection collapsed and just
|
/// If [selectionEnabled] is false, keeps the selection collapsed and just
|
||||||
/// moves it down.
|
/// moves it down.
|
||||||
///
|
///
|
||||||
/// {@template flutter.rendering.RenderEditable.cause}
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
/// The given [SelectionChangedCause] indicates the cause of this change and
|
|
||||||
/// will be passed to [onSelectionChanged].
|
|
||||||
/// {@endtemplate}
|
|
||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
@ -1375,10 +1736,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
///
|
///
|
||||||
/// {@macro flutter.rendering.RenderEditable.cause}
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
///
|
///
|
||||||
/// By default, `includeWhitespace` is set to true, meaning that whitespace
|
/// {@macro flutter.rendering.RenderEditable.whiteSpace}
|
||||||
/// can be considered a word in itself. If set to false, the selection will
|
|
||||||
/// be extended past any whitespace and the first word following the
|
|
||||||
/// whitespace.
|
|
||||||
///
|
///
|
||||||
/// {@template flutter.rendering.RenderEditable.stopAtReversal}
|
/// {@template flutter.rendering.RenderEditable.stopAtReversal}
|
||||||
/// The `stopAtReversal` parameter is false by default, meaning that it's
|
/// The `stopAtReversal` parameter is false by default, meaning that it's
|
||||||
@ -1418,13 +1776,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
///
|
///
|
||||||
/// {@macro flutter.rendering.RenderEditable.cause}
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
///
|
///
|
||||||
/// By default, `includeWhitespace` is set to true, meaning that whitespace
|
/// {@macro flutter.rendering.RenderEditable.whiteSpace}
|
||||||
/// can be considered a word in itself. If set to false, the selection will
|
|
||||||
/// be extended past any whitespace and the first word following the
|
|
||||||
/// whitespace.
|
|
||||||
///
|
///
|
||||||
/// {@macro flutter.rendering.RenderEditable.stopAtReversal}
|
/// {@macro flutter.rendering.RenderEditable.stopAtReversal}
|
||||||
///
|
///
|
||||||
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
/// * [extendSelectionLeftByWord], which is the same but in the opposite
|
/// * [extendSelectionLeftByWord], which is the same but in the opposite
|
||||||
@ -1581,9 +1937,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
///
|
///
|
||||||
/// {@macro flutter.rendering.RenderEditable.cause}
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
///
|
///
|
||||||
/// By default, includeWhitespace is set to true, meaning that whitespace can
|
/// {@macro flutter.rendering.RenderEditable.whiteSpace}
|
||||||
/// be considered a word in itself. If set to false, the selection will be
|
|
||||||
/// moved past any whitespace and the first word following the whitespace.
|
|
||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
@ -1667,9 +2021,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
///
|
///
|
||||||
/// {@macro flutter.rendering.RenderEditable.cause}
|
/// {@macro flutter.rendering.RenderEditable.cause}
|
||||||
///
|
///
|
||||||
/// By default, includeWhitespace is set to true, meaning that whitespace can
|
/// {@macro flutter.rendering.RenderEditable.whiteSpace}
|
||||||
/// be considered a word in itself. If set to false, the selection will be
|
|
||||||
/// moved past any whitespace and the first word following the whitespace.
|
|
||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
@ -1817,38 +2169,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleDelete({ required bool forward }) {
|
|
||||||
final TextSelection selection = textSelectionDelegate.textEditingValue.selection;
|
|
||||||
final String text = textSelectionDelegate.textEditingValue.text;
|
|
||||||
assert(_selection != null);
|
|
||||||
if (_readOnly || !selection.isValid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String textBefore = selection.textBefore(text);
|
|
||||||
String textAfter = selection.textAfter(text);
|
|
||||||
int cursorPosition = math.min(selection.start, selection.end);
|
|
||||||
// If not deleting a selection, delete the next/previous character.
|
|
||||||
if (selection.isCollapsed) {
|
|
||||||
if (!forward && textBefore.isNotEmpty) {
|
|
||||||
final int characterBoundary = previousCharacter(textBefore.length, textBefore);
|
|
||||||
textBefore = textBefore.substring(0, characterBoundary);
|
|
||||||
cursorPosition = characterBoundary;
|
|
||||||
}
|
|
||||||
if (forward && textAfter.isNotEmpty) {
|
|
||||||
final int deleteCount = nextCharacter(0, textAfter);
|
|
||||||
textAfter = textAfter.substring(deleteCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final TextSelection newSelection = TextSelection.collapsed(offset: cursorPosition);
|
|
||||||
_setTextEditingValue(
|
|
||||||
TextEditingValue(
|
|
||||||
text: textBefore + textAfter,
|
|
||||||
selection: newSelection,
|
|
||||||
),
|
|
||||||
SelectionChangedCause.keyboard,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void markNeedsPaint() {
|
void markNeedsPaint() {
|
||||||
super.markNeedsPaint();
|
super.markNeedsPaint();
|
||||||
|
@ -36,6 +36,12 @@ class DefaultTextEditingActions extends Actions{
|
|||||||
// are called on which platform.
|
// are called on which platform.
|
||||||
static final Map<Type, Action<Intent>> _shortcutsActions = <Type, Action<Intent>>{
|
static final Map<Type, Action<Intent>> _shortcutsActions = <Type, Action<Intent>>{
|
||||||
DoNothingAndStopPropagationTextIntent: _DoNothingAndStopPropagationTextAction(),
|
DoNothingAndStopPropagationTextIntent: _DoNothingAndStopPropagationTextAction(),
|
||||||
|
DeleteTextIntent: _DeleteTextAction(),
|
||||||
|
DeleteByWordTextIntent: _DeleteByWordTextAction(),
|
||||||
|
DeleteByLineTextIntent: _DeleteByLineTextAction(),
|
||||||
|
DeleteForwardTextIntent: _DeleteForwardTextAction(),
|
||||||
|
DeleteForwardByWordTextIntent: _DeleteForwardByWordTextAction(),
|
||||||
|
DeleteForwardByLineTextIntent: _DeleteForwardByLineTextAction(),
|
||||||
ExtendSelectionDownTextIntent: _ExtendSelectionDownTextAction(),
|
ExtendSelectionDownTextIntent: _ExtendSelectionDownTextAction(),
|
||||||
ExtendSelectionLeftByLineTextIntent: _ExtendSelectionLeftByLineTextAction(),
|
ExtendSelectionLeftByLineTextIntent: _ExtendSelectionLeftByLineTextAction(),
|
||||||
ExtendSelectionLeftByWordTextIntent: _ExtendSelectionLeftByWordTextAction(),
|
ExtendSelectionLeftByWordTextIntent: _ExtendSelectionLeftByWordTextAction(),
|
||||||
@ -76,6 +82,48 @@ class _DoNothingAndStopPropagationTextAction extends TextEditingAction<DoNothing
|
|||||||
void invoke(DoNothingAndStopPropagationTextIntent intent, [BuildContext? context]) {}
|
void invoke(DoNothingAndStopPropagationTextIntent intent, [BuildContext? context]) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _DeleteTextAction extends TextEditingAction<DeleteTextIntent> {
|
||||||
|
@override
|
||||||
|
Object? invoke(DeleteTextIntent intent, [BuildContext? context]) {
|
||||||
|
textEditingActionTarget!.renderEditable.delete(SelectionChangedCause.keyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeleteByWordTextAction extends TextEditingAction<DeleteByWordTextIntent> {
|
||||||
|
@override
|
||||||
|
Object? invoke(DeleteByWordTextIntent intent, [BuildContext? context]) {
|
||||||
|
textEditingActionTarget!.renderEditable.deleteByWord(SelectionChangedCause.keyboard, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeleteByLineTextAction extends TextEditingAction<DeleteByLineTextIntent> {
|
||||||
|
@override
|
||||||
|
Object? invoke(DeleteByLineTextIntent intent, [BuildContext? context]) {
|
||||||
|
textEditingActionTarget!.renderEditable.deleteByLine(SelectionChangedCause.keyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeleteForwardTextAction extends TextEditingAction<DeleteForwardTextIntent> {
|
||||||
|
@override
|
||||||
|
Object? invoke(DeleteForwardTextIntent intent, [BuildContext? context]) {
|
||||||
|
textEditingActionTarget!.renderEditable.deleteForward(SelectionChangedCause.keyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeleteForwardByWordTextAction extends TextEditingAction<DeleteForwardByWordTextIntent> {
|
||||||
|
@override
|
||||||
|
Object? invoke(DeleteForwardByWordTextIntent intent, [BuildContext? context]) {
|
||||||
|
textEditingActionTarget!.renderEditable.deleteForwardByWord(SelectionChangedCause.keyboard, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeleteForwardByLineTextAction extends TextEditingAction<DeleteForwardByLineTextIntent> {
|
||||||
|
@override
|
||||||
|
Object? invoke(DeleteForwardByLineTextIntent intent, [BuildContext? context]) {
|
||||||
|
textEditingActionTarget!.renderEditable.deleteForwardByLine(SelectionChangedCause.keyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class _ExpandSelectionLeftByLineTextAction extends TextEditingAction<ExpandSelectionLeftByLineTextIntent> {
|
class _ExpandSelectionLeftByLineTextAction extends TextEditingAction<ExpandSelectionLeftByLineTextIntent> {
|
||||||
@override
|
@override
|
||||||
Object? invoke(ExpandSelectionLeftByLineTextIntent intent, [BuildContext? context]) {
|
Object? invoke(ExpandSelectionLeftByLineTextIntent intent, [BuildContext? context]) {
|
||||||
|
@ -161,6 +161,12 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
);
|
);
|
||||||
|
|
||||||
static final Map<LogicalKeySet, Intent> _androidShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _androidShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
||||||
@ -195,9 +201,17 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
// * Meta + shift + arrow up
|
// * Meta + shift + arrow up
|
||||||
// * Shift + end
|
// * Shift + end
|
||||||
// * Shift + home
|
// * Shift + home
|
||||||
|
// * Meta + delete
|
||||||
|
// * Meta + backspace
|
||||||
};
|
};
|
||||||
|
|
||||||
static final Map<LogicalKeySet, Intent> _fuchsiaShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _fuchsiaShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
||||||
@ -232,9 +246,17 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
// * Meta + shift + arrow up
|
// * Meta + shift + arrow up
|
||||||
// * Shift + end
|
// * Shift + end
|
||||||
// * Shift + home
|
// * Shift + home
|
||||||
|
// * Meta + delete
|
||||||
|
// * Meta + backspace
|
||||||
};
|
};
|
||||||
|
|
||||||
static final Map<LogicalKeySet, Intent> _iOSShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _iOSShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
||||||
@ -269,9 +291,17 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
// * Meta + shift + arrow up
|
// * Meta + shift + arrow up
|
||||||
// * Shift + end
|
// * Shift + end
|
||||||
// * Shift + home
|
// * Shift + home
|
||||||
|
// * Meta + delete
|
||||||
|
// * Meta + backspace
|
||||||
};
|
};
|
||||||
|
|
||||||
static final Map<LogicalKeySet, Intent> _linuxShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _linuxShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
||||||
@ -306,9 +336,17 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
// * Meta + shift + arrow up
|
// * Meta + shift + arrow up
|
||||||
// * Shift + end
|
// * Shift + end
|
||||||
// * Shift + home
|
// * Shift + home
|
||||||
|
// * Meta + delete
|
||||||
|
// * Meta + backspace
|
||||||
};
|
};
|
||||||
|
|
||||||
static final Map<LogicalKeySet, Intent> _macShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _macShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionRightByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionRightByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(),
|
||||||
@ -343,9 +381,17 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
// * Home
|
// * Home
|
||||||
// * Shift + end
|
// * Shift + end
|
||||||
// * Shift + home
|
// * Shift + home
|
||||||
|
// * Control + delete
|
||||||
|
// * Control + backspace
|
||||||
};
|
};
|
||||||
|
|
||||||
static final Map<LogicalKeySet, Intent> _windowsShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _windowsShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(),
|
||||||
@ -380,11 +426,21 @@ class DefaultTextEditingShortcuts extends Shortcuts {
|
|||||||
// * Meta + shift + arrow left
|
// * Meta + shift + arrow left
|
||||||
// * Meta + shift + arrow right
|
// * Meta + shift + arrow right
|
||||||
// * Meta + shift + arrow up
|
// * Meta + shift + arrow up
|
||||||
|
// * Meta + delete
|
||||||
|
// * Meta + backspace
|
||||||
};
|
};
|
||||||
|
|
||||||
// Web handles its text selection natively and doesn't use any of these
|
// Web handles its text selection natively and doesn't use any of these
|
||||||
// shortcuts in Flutter.
|
// shortcuts in Flutter.
|
||||||
static final Map<LogicalKeySet, Intent> _webShortcuts = <LogicalKeySet, Intent>{
|
static final Map<LogicalKeySet, Intent> _webShortcuts = <LogicalKeySet, Intent>{
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(),
|
||||||
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(),
|
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(),
|
||||||
|
@ -4,6 +4,54 @@
|
|||||||
|
|
||||||
import 'actions.dart';
|
import 'actions.dart';
|
||||||
|
|
||||||
|
/// An [Intent] to delete a character in the backwards direction.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
|
||||||
|
class DeleteTextIntent extends Intent{
|
||||||
|
/// Creates an instance of DeleteTextIntent.
|
||||||
|
const DeleteTextIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An [Intent] to delete a word in the backwards direction.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
|
||||||
|
class DeleteByWordTextIntent extends Intent{
|
||||||
|
/// Creates an instance of DeleteByWordTextIntent.
|
||||||
|
const DeleteByWordTextIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An [Intent] to delete a line in the backwards direction.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
|
||||||
|
class DeleteByLineTextIntent extends Intent{
|
||||||
|
/// Creates an instance of DeleteByLineTextIntent.
|
||||||
|
const DeleteByLineTextIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An [Intent] to delete in the forward direction.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
|
||||||
|
class DeleteForwardTextIntent extends Intent{
|
||||||
|
/// Creates an instance of DeleteForwardTextIntent.
|
||||||
|
const DeleteForwardTextIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An [Intent] to delete a word in the forward direction.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
|
||||||
|
class DeleteForwardByWordTextIntent extends Intent{
|
||||||
|
/// Creates an instance of DeleteByWordTextIntent.
|
||||||
|
const DeleteForwardByWordTextIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An [Intent] to delete a line in the forward direction.
|
||||||
|
///
|
||||||
|
/// {@macro flutter.widgets.TextEditingIntents.seeAlso}
|
||||||
|
class DeleteForwardByLineTextIntent extends Intent{
|
||||||
|
/// Creates an instance of DeleteByLineTextIntent.
|
||||||
|
const DeleteForwardByLineTextIntent();
|
||||||
|
}
|
||||||
|
|
||||||
/// An [Intent] to send the event straight to the engine, but only if a
|
/// An [Intent] to send the event straight to the engine, but only if a
|
||||||
/// TextEditingTarget is focused.
|
/// TextEditingTarget is focused.
|
||||||
///
|
///
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user