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
4a1002e2
Unverified
Commit
4a1002e2
authored
Mar 26, 2023
by
Jan Kuß
Committed by
GitHub
Mar 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix selection toolbar not showing on drag end (#121110)
parent
1fb2158e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
selectable_region.dart
packages/flutter/lib/src/widgets/selectable_region.dart
+1
-0
selection_area_test.dart
packages/flutter/test/material/selection_area_test.dart
+49
-0
No files found.
packages/flutter/lib/src/widgets/selectable_region.dart
View file @
4a1002e2
...
...
@@ -537,6 +537,7 @@ class SelectableRegionState extends State<SelectableRegion> with TextSelectionDe
}
else
{
_selectionOverlay
!.
hideMagnifier
();
_selectionOverlay
!.
showToolbar
(
context:
context
,
contextMenuBuilder:
(
BuildContext
context
)
{
return
widget
.
contextMenuBuilder
!(
context
,
this
);
},
...
...
packages/flutter/test/material/selection_area_test.dart
View file @
4a1002e2
...
...
@@ -129,4 +129,53 @@ void main() {
expect
(
content
,
isNotNull
);
expect
(
content
!.
plainText
,
'How'
);
});
testWidgets
(
'stopping drag of end handle will show the toolbar'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/119314
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
64
),
child:
Column
(
children:
<
Widget
>[
const
Text
(
'How are you?'
),
SelectionArea
(
focusNode:
FocusNode
(),
child:
const
Text
(
'Good, and you?'
),
),
const
Text
(
'Fine, thank you.'
),
],
),
),
),
),
);
final
RenderParagraph
paragraph2
=
tester
.
renderObject
<
RenderParagraph
>(
find
.
descendant
(
of:
find
.
text
(
'Good, and you?'
),
matching:
find
.
byType
(
RichText
)));
final
TestGesture
gesture
=
await
tester
.
startGesture
(
textOffsetToPosition
(
paragraph2
,
7
));
// at the 'a'
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
await
gesture
.
up
();
final
List
<
TextBox
>
boxes
=
paragraph2
.
getBoxesForSelection
(
paragraph2
.
selections
[
0
]);
expect
(
boxes
.
length
,
1
);
// There is a selection now.
// We check the presence of the copy button to make sure the selection toolbar
// is showing.
expect
(
find
.
text
(
'Copy'
),
findsOneWidget
);
// This is the position of the selection handle displayed at the end.
final
Offset
handlePos
=
paragraph2
.
localToGlobal
(
boxes
[
0
].
toRect
().
bottomRight
);
await
gesture
.
down
(
handlePos
);
await
gesture
.
moveTo
(
textOffsetToPosition
(
paragraph2
,
11
)
+
Offset
(
0
,
paragraph2
.
size
.
height
/
2
));
await
tester
.
pump
();
await
gesture
.
up
();
await
tester
.
pump
();
// After lifting the finger up, the selection toolbar should be showing again.
expect
(
find
.
text
(
'Copy'
),
findsOneWidget
);
},
variant:
TargetPlatformVariant
.
all
(),
skip:
kIsWeb
,
// [intended]
);
}
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