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
297a7c75
Unverified
Commit
297a7c75
authored
Nov 16, 2021
by
Justin McCandless
Committed by
GitHub
Nov 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Desktop edge scrolling (#93170)
parent
3f8e77ed
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
409 additions
and
16 deletions
+409
-16
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+18
-3
monodrag.dart
packages/flutter/lib/src/gestures/monodrag.dart
+7
-1
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+9
-5
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+3
-5
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+1
-1
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+371
-1
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
297a7c75
...
@@ -967,15 +967,30 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
...
@@ -967,15 +967,30 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
}
}
void
_handleSelectionChanged
(
TextSelection
selection
,
SelectionChangedCause
?
cause
)
{
void
_handleSelectionChanged
(
TextSelection
selection
,
SelectionChangedCause
?
cause
)
{
if
(
cause
==
SelectionChangedCause
.
longPress
)
{
_editableText
.
bringIntoView
(
selection
.
base
);
}
final
bool
willShowSelectionHandles
=
_shouldShowSelectionHandles
(
cause
);
final
bool
willShowSelectionHandles
=
_shouldShowSelectionHandles
(
cause
);
if
(
willShowSelectionHandles
!=
_showSelectionHandles
)
{
if
(
willShowSelectionHandles
!=
_showSelectionHandles
)
{
setState
(()
{
setState
(()
{
_showSelectionHandles
=
willShowSelectionHandles
;
_showSelectionHandles
=
willShowSelectionHandles
;
});
});
}
}
switch
(
defaultTargetPlatform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
if
(
cause
==
SelectionChangedCause
.
longPress
||
cause
==
SelectionChangedCause
.
drag
)
{
_editableText
.
bringIntoView
(
selection
.
extent
);
}
return
;
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
android
:
if
(
cause
==
SelectionChangedCause
.
drag
)
{
_editableText
.
bringIntoView
(
selection
.
extent
);
}
return
;
}
}
}
@override
@override
...
...
packages/flutter/lib/src/gestures/monodrag.dart
View file @
297a7c75
...
@@ -614,7 +614,13 @@ class HorizontalDragGestureRecognizer extends DragGestureRecognizer {
...
@@ -614,7 +614,13 @@ class HorizontalDragGestureRecognizer extends DragGestureRecognizer {
/// some time has passed.
/// some time has passed.
class
PanGestureRecognizer
extends
DragGestureRecognizer
{
class
PanGestureRecognizer
extends
DragGestureRecognizer
{
/// Create a gesture recognizer for tracking movement on a plane.
/// Create a gesture recognizer for tracking movement on a plane.
PanGestureRecognizer
({
Object
?
debugOwner
})
:
super
(
debugOwner:
debugOwner
);
PanGestureRecognizer
({
Object
?
debugOwner
,
Set
<
PointerDeviceKind
>?
supportedDevices
,
})
:
super
(
debugOwner:
debugOwner
,
supportedDevices:
supportedDevices
,
);
@override
@override
bool
isFlingGesture
(
VelocityEstimate
estimate
,
PointerDeviceKind
kind
)
{
bool
isFlingGesture
(
VelocityEstimate
estimate
,
PointerDeviceKind
kind
)
{
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
297a7c75
...
@@ -1075,15 +1075,19 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
...
@@ -1075,15 +1075,19 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
switch
(
Theme
.
of
(
context
).
platform
)
{
switch
(
Theme
.
of
(
context
).
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
macOS
:
if
(
cause
==
SelectionChangedCause
.
longPress
)
{
if
(
cause
==
SelectionChangedCause
.
longPress
_editableText
?.
bringIntoView
(
selection
.
base
);
||
cause
==
SelectionChangedCause
.
drag
)
{
_editableText
?.
bringIntoView
(
selection
.
extent
);
}
}
return
;
return
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
// Do nothing.
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
android
:
if
(
cause
==
SelectionChangedCause
.
drag
)
{
_editableText
?.
bringIntoView
(
selection
.
extent
);
}
return
;
}
}
}
}
...
...
packages/flutter/lib/src/widgets/text_selection.dart
View file @
297a7c75
...
@@ -1527,11 +1527,9 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
...
@@ -1527,11 +1527,9 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
if
(
widget
.
onDragSelectionStart
!=
null
||
if
(
widget
.
onDragSelectionStart
!=
null
||
widget
.
onDragSelectionUpdate
!=
null
||
widget
.
onDragSelectionUpdate
!=
null
||
widget
.
onDragSelectionEnd
!=
null
)
{
widget
.
onDragSelectionEnd
!=
null
)
{
// TODO(mdebbar): Support dragging in any direction (for multiline text).
gestures
[
PanGestureRecognizer
]
=
GestureRecognizerFactoryWithHandlers
<
PanGestureRecognizer
>(
// https://github.com/flutter/flutter/issues/28676
()
=>
PanGestureRecognizer
(
debugOwner:
this
,
supportedDevices:
<
PointerDeviceKind
>{
PointerDeviceKind
.
mouse
}),
gestures
[
HorizontalDragGestureRecognizer
]
=
GestureRecognizerFactoryWithHandlers
<
HorizontalDragGestureRecognizer
>(
(
PanGestureRecognizer
instance
)
{
()
=>
HorizontalDragGestureRecognizer
(
debugOwner:
this
,
kind:
PointerDeviceKind
.
mouse
),
(
HorizontalDragGestureRecognizer
instance
)
{
instance
instance
// Text selection should start from the position of the first pointer
// Text selection should start from the position of the first pointer
// down event.
// down event.
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
297a7c75
...
@@ -2414,7 +2414,7 @@ void main() {
...
@@ -2414,7 +2414,7 @@ void main() {
expect
(
firstCharEndpoint
.
length
,
1
);
expect
(
firstCharEndpoint
.
length
,
1
);
// The first character is now offscreen to the left.
// The first character is now offscreen to the left.
expect
(
firstCharEndpoint
[
0
].
point
.
dx
,
moreOrLessEquals
(-
308.20
,
epsilon:
0.25
));
expect
(
firstCharEndpoint
[
0
].
point
.
dx
,
moreOrLessEquals
(-
308.20
,
epsilon:
0.25
));
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
testWidgets
(
'long tap after a double tap select is not affected'
,
'long tap after a double tap select is not affected'
,
...
...
packages/flutter/test/material/text_field_test.dart
View file @
297a7c75
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