Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
fa98a522
Unverified
Commit
fa98a522
authored
Feb 08, 2022
by
Justin McCandless
Committed by
GitHub
Feb 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo/redo (#96968)
parent
93a1b7a5
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
820 additions
and
84 deletions
+820
-84
default_text_editing_shortcuts.dart
...utter/lib/src/widgets/default_text_editing_shortcuts.dart
+8
-0
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+343
-83
text_editing_intents.dart
packages/flutter/lib/src/widgets/text_editing_intents.dart
+21
-1
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+448
-0
No files found.
packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart
View file @
fa98a522
...
@@ -205,6 +205,8 @@ class DefaultTextEditingShortcuts extends Shortcuts {
...
@@ -205,6 +205,8 @@ class DefaultTextEditingShortcuts extends Shortcuts {
const
SingleActivator
(
LogicalKeyboardKey
.
keyC
,
control:
true
):
CopySelectionTextIntent
.
copy
,
const
SingleActivator
(
LogicalKeyboardKey
.
keyC
,
control:
true
):
CopySelectionTextIntent
.
copy
,
const
SingleActivator
(
LogicalKeyboardKey
.
keyV
,
control:
true
):
const
PasteTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyV
,
control:
true
):
const
PasteTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyA
,
control:
true
):
const
SelectAllTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyA
,
control:
true
):
const
SelectAllTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyZ
,
control:
true
):
const
UndoTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyZ
,
shift:
true
,
control:
true
):
const
RedoTextIntent
(
SelectionChangedCause
.
keyboard
),
};
};
// The following key combinations have no effect on text editing on this
// The following key combinations have no effect on text editing on this
...
@@ -215,6 +217,7 @@ class DefaultTextEditingShortcuts extends Shortcuts {
...
@@ -215,6 +217,7 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + C
// * Meta + C
// * Meta + V
// * Meta + V
// * Meta + A
// * Meta + A
// * Meta + shift? + Z
// * Meta + shift? + arrow down
// * Meta + shift? + arrow down
// * Meta + shift? + arrow left
// * Meta + shift? + arrow left
// * Meta + shift? + arrow right
// * Meta + shift? + arrow right
...
@@ -235,6 +238,7 @@ class DefaultTextEditingShortcuts extends Shortcuts {
...
@@ -235,6 +238,7 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + C
// * Meta + C
// * Meta + V
// * Meta + V
// * Meta + A
// * Meta + A
// * Meta + shift? + Z
// * Meta + shift? + arrow down
// * Meta + shift? + arrow down
// * Meta + shift? + arrow left
// * Meta + shift? + arrow left
// * Meta + shift? + arrow right
// * Meta + shift? + arrow right
...
@@ -259,6 +263,7 @@ class DefaultTextEditingShortcuts extends Shortcuts {
...
@@ -259,6 +263,7 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + C
// * Meta + C
// * Meta + V
// * Meta + V
// * Meta + A
// * Meta + A
// * Meta + shift? + Z
// * Meta + shift? + arrow down
// * Meta + shift? + arrow down
// * Meta + shift? + arrow left
// * Meta + shift? + arrow left
// * Meta + shift? + arrow right
// * Meta + shift? + arrow right
...
@@ -319,12 +324,15 @@ class DefaultTextEditingShortcuts extends Shortcuts {
...
@@ -319,12 +324,15 @@ class DefaultTextEditingShortcuts extends Shortcuts {
const
SingleActivator
(
LogicalKeyboardKey
.
keyC
,
meta:
true
):
CopySelectionTextIntent
.
copy
,
const
SingleActivator
(
LogicalKeyboardKey
.
keyC
,
meta:
true
):
CopySelectionTextIntent
.
copy
,
const
SingleActivator
(
LogicalKeyboardKey
.
keyV
,
meta:
true
):
const
PasteTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyV
,
meta:
true
):
const
PasteTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyA
,
meta:
true
):
const
SelectAllTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyA
,
meta:
true
):
const
SelectAllTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyZ
,
meta:
true
):
const
UndoTextIntent
(
SelectionChangedCause
.
keyboard
),
const
SingleActivator
(
LogicalKeyboardKey
.
keyZ
,
shift:
true
,
meta:
true
):
const
RedoTextIntent
(
SelectionChangedCause
.
keyboard
),
// The following key combinations have no effect on text editing on this
// The following key combinations have no effect on text editing on this
// platform:
// platform:
// * End
// * End
// * Home
// * Home
// * Control + shift? + end
// * Control + shift? + end
// * Control + shift? + home
// * Control + shift? + home
// * Control + shift? + Z
};
};
// The following key combinations have no effect on text editing on this
// The following key combinations have no effect on text editing on this
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
fa98a522
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/text_editing_intents.dart
View file @
fa98a522
...
@@ -231,6 +231,16 @@ class PasteTextIntent extends Intent {
...
@@ -231,6 +231,16 @@ class PasteTextIntent extends Intent {
final
SelectionChangedCause
cause
;
final
SelectionChangedCause
cause
;
}
}
/// An [Intent] that represents a user interaction that attempts to go back to
/// the previous editing state.
class
RedoTextIntent
extends
Intent
{
/// Creates a [RedoTextIntent].
const
RedoTextIntent
(
this
.
cause
);
/// {@macro flutter.widgets.TextEditingIntents.cause}
final
SelectionChangedCause
cause
;
}
/// An [Intent] that represents a user interaction that attempts to modify the
/// An [Intent] that represents a user interaction that attempts to modify the
/// current [TextEditingValue] in an input field.
/// current [TextEditingValue] in an input field.
class
ReplaceTextIntent
extends
Intent
{
class
ReplaceTextIntent
extends
Intent
{
...
@@ -250,10 +260,20 @@ class ReplaceTextIntent extends Intent {
...
@@ -250,10 +260,20 @@ class ReplaceTextIntent extends Intent {
final
SelectionChangedCause
cause
;
final
SelectionChangedCause
cause
;
}
}
/// An [Intent] that represents a user interaction that attempts to go back to
/// the previous editing state.
class
UndoTextIntent
extends
Intent
{
/// Creates an [UndoTextIntent].
const
UndoTextIntent
(
this
.
cause
);
/// {@macro flutter.widgets.TextEditingIntents.cause}
final
SelectionChangedCause
cause
;
}
/// An [Intent] that represents a user interaction that attempts to change the
/// An [Intent] that represents a user interaction that attempts to change the
/// selection in an input field.
/// selection in an input field.
class
UpdateSelectionIntent
extends
Intent
{
class
UpdateSelectionIntent
extends
Intent
{
/// Creates a [UpdateSelectionIntent].
/// Creates a
n
[UpdateSelectionIntent].
const
UpdateSelectionIntent
(
this
.
currentTextEditingValue
,
this
.
newSelection
,
this
.
cause
);
const
UpdateSelectionIntent
(
this
.
currentTextEditingValue
,
this
.
newSelection
,
this
.
cause
);
/// The [TextEditingValue] that this [Intent]'s action should perform on.
/// The [TextEditingValue] that this [Intent]'s action should perform on.
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
fa98a522
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment