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
8f9a5195
Unverified
Commit
8f9a5195
authored
Sep 12, 2022
by
Justin McCandless
Committed by
GitHub
Sep 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Magnifier crash (#111303)
parent
52af1a51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+2
-2
text_selection_test.dart
packages/flutter/test/widgets/text_selection_test.dart
+31
-0
No files found.
packages/flutter/lib/src/widgets/text_selection.dart
View file @
8f9a5195
...
@@ -853,7 +853,7 @@ class SelectionOverlay {
...
@@ -853,7 +853,7 @@ class SelectionOverlay {
_magnifierOverlayInfoBearer
,
_magnifierOverlayInfoBearer
,
);
);
if
(
builtMagnifier
==
null
||
_handles
==
null
)
{
if
(
builtMagnifier
==
null
)
{
return
;
return
;
}
}
...
@@ -861,7 +861,7 @@ class SelectionOverlay {
...
@@ -861,7 +861,7 @@ class SelectionOverlay {
context:
context
,
context:
context
,
below:
magnifierConfiguration
.
shouldDisplayHandlesInMagnifier
below:
magnifierConfiguration
.
shouldDisplayHandlesInMagnifier
?
null
?
null
:
_handles
!
.
first
,
:
_handles
?
.
first
,
builder:
(
_
)
=>
builtMagnifier
);
builder:
(
_
)
=>
builtMagnifier
);
}
}
...
...
packages/flutter/test/widgets/text_selection_test.dart
View file @
8f9a5195
...
@@ -1030,6 +1030,7 @@ void main() {
...
@@ -1030,6 +1030,7 @@ void main() {
ValueChanged
<
DragEndDetails
>?
onEndDragEnd
,
ValueChanged
<
DragEndDetails
>?
onEndDragEnd
,
VoidCallback
?
onSelectionHandleTapped
,
VoidCallback
?
onSelectionHandleTapped
,
TextSelectionControls
?
selectionControls
,
TextSelectionControls
?
selectionControls
,
TextMagnifierConfiguration
?
magnifierConfiguration
,
})
async
{
})
async
{
final
UniqueKey
column
=
UniqueKey
();
final
UniqueKey
column
=
UniqueKey
();
final
LayerLink
startHandleLayerLink
=
LayerLink
();
final
LayerLink
startHandleLayerLink
=
LayerLink
();
...
@@ -1075,6 +1076,7 @@ void main() {
...
@@ -1075,6 +1076,7 @@ void main() {
selectionControls:
selectionControls
,
selectionControls:
selectionControls
,
selectionEndpoints:
const
<
TextSelectionPoint
>[],
selectionEndpoints:
const
<
TextSelectionPoint
>[],
toolbarLayerLink:
toolbarLayerLink
,
toolbarLayerLink:
toolbarLayerLink
,
magnifierConfiguration:
magnifierConfiguration
??
TextMagnifierConfiguration
.
disabled
,
);
);
}
}
...
@@ -1279,6 +1281,35 @@ void main() {
...
@@ -1279,6 +1281,35 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
20
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
20
));
expect
(
endDragEndDetails
,
isNotNull
);
expect
(
endDragEndDetails
,
isNotNull
);
});
});
testWidgets
(
'can show magnifier when no handles exist'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
magnifierKey
=
GlobalKey
();
final
SelectionOverlay
selectionOverlay
=
await
pumpApp
(
tester
,
magnifierConfiguration:
TextMagnifierConfiguration
(
shouldDisplayHandlesInMagnifier:
false
,
magnifierBuilder:
(
BuildContext
context
,
MagnifierController
controller
,
ValueNotifier
<
MagnifierOverlayInfoBearer
>?
notifier
)
{
return
SizedBox
.
shrink
(
key:
magnifierKey
,
);
},
),
);
expect
(
find
.
byKey
(
magnifierKey
),
findsNothing
);
final
MagnifierOverlayInfoBearer
info
=
MagnifierOverlayInfoBearer
(
globalGesturePosition:
Offset
.
zero
,
caretRect:
Offset
.
zero
&
const
Size
(
5.0
,
20.0
),
fieldBounds:
Offset
.
zero
&
const
Size
(
200.0
,
50.0
),
currentLineBoundaries:
Offset
.
zero
&
const
Size
(
200.0
,
50.0
),
);
selectionOverlay
.
showMagnifier
(
info
);
await
tester
.
pump
();
expect
(
tester
.
takeException
(),
isNull
);
expect
(
find
.
byKey
(
magnifierKey
),
findsOneWidget
);
});
});
});
group
(
'ClipboardStatusNotifier'
,
()
{
group
(
'ClipboardStatusNotifier'
,
()
{
...
...
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