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
c61e55ad
Commit
c61e55ad
authored
Jan 17, 2020
by
Justin McCandless
Committed by
Flutter GitHub Bot
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selection menu not showing when selection is 0,0 (#49000)
parent
f013b25b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
editable.dart
packages/flutter/lib/src/rendering/editable.dart
+8
-2
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+21
-0
No files found.
packages/flutter/lib/src/rendering/editable.dart
View file @
c61e55ad
...
...
@@ -409,8 +409,14 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
)
{
// Changes made by the keyboard can sometimes be "out of band" for listening
// components, so always send those events, even if we didn't think it
// changed.
if
(
nextSelection
==
selection
&&
cause
!=
SelectionChangedCause
.
keyboard
)
{
// changed. Also, focusing an empty field is sent as a selection change even
// if the selection offset didn't change.
final
bool
focusingEmpty
=
nextSelection
.
baseOffset
==
0
&&
nextSelection
.
extentOffset
==
0
&&
!
hasFocus
;
if
(
nextSelection
==
selection
&&
cause
!=
SelectionChangedCause
.
keyboard
&&
!
focusingEmpty
)
{
return
;
}
if
(
onSelectionChanged
!=
null
)
{
...
...
packages/flutter/test/material/text_field_test.dart
View file @
c61e55ad
...
...
@@ -857,6 +857,27 @@ void main() {
expect
(
handle
.
opacity
.
value
,
equals
(
1.0
));
});
testWidgets
(
'Long pressing a field with selection 0,0 shows the selection menu'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
overlay
(
child:
TextField
(
controller:
TextEditingController
.
fromValue
(
const
TextEditingValue
(
selection:
TextSelection
(
baseOffset:
0
,
extentOffset:
0
),
),
),
),
));
expect
(
find
.
text
(
'PASTE'
),
findsNothing
);
final
Offset
emptyPos
=
textOffsetToPosition
(
tester
,
0
);
await
tester
.
longPressAt
(
emptyPos
,
pointer:
7
);
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'PASTE'
),
findsOneWidget
);
});
testWidgets
(
'Entering text hides selection handle caret'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
();
...
...
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