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
2f45458e
Unverified
Commit
2f45458e
authored
Apr 17, 2023
by
hangyu
Committed by
GitHub
Apr 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a null crash in SelectableRegion Widget (#124736)
issue #123378
parent
df8d8194
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
selectable_region.dart
packages/flutter/lib/src/widgets/selectable_region.dart
+2
-2
selection_area_test.dart
packages/flutter/test/material/selection_area_test.dart
+31
-0
No files found.
packages/flutter/lib/src/widgets/selectable_region.dart
View file @
2f45458e
...
...
@@ -1301,13 +1301,13 @@ class _SelectableRegionContainerDelegate extends MultiSelectableSelectionContain
}
void
_updateLastEdgeEventsFromGeometries
()
{
if
(
currentSelectionStartIndex
!=
-
1
)
{
if
(
currentSelectionStartIndex
!=
-
1
&&
selectables
[
currentSelectionStartIndex
].
value
.
hasSelection
)
{
final
Selectable
start
=
selectables
[
currentSelectionStartIndex
];
final
Offset
localStartEdge
=
start
.
value
.
startSelectionPoint
!.
localPosition
+
Offset
(
0
,
-
start
.
value
.
startSelectionPoint
!.
lineHeight
/
2
);
_lastStartEdgeUpdateGlobalPosition
=
MatrixUtils
.
transformPoint
(
start
.
getTransformTo
(
null
),
localStartEdge
);
}
if
(
currentSelectionEndIndex
!=
-
1
)
{
if
(
currentSelectionEndIndex
!=
-
1
&&
selectables
[
currentSelectionEndIndex
].
value
.
hasSelection
)
{
final
Selectable
end
=
selectables
[
currentSelectionEndIndex
];
final
Offset
localEndEdge
=
end
.
value
.
endSelectionPoint
!.
localPosition
+
Offset
(
0
,
-
end
.
value
.
endSelectionPoint
!.
lineHeight
/
2
);
...
...
packages/flutter/test/material/selection_area_test.dart
View file @
2f45458e
...
...
@@ -38,6 +38,37 @@ void main() {
}
},
variant:
TargetPlatformVariant
.
all
());
testWidgets
(
'Does not crash when long pressing on padding after dragging'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/123378
await
tester
.
pumpWidget
(
const
MaterialApp
(
color:
Color
(
0xFF2196F3
),
title:
'Demo'
,
home:
Scaffold
(
body:
SelectionArea
(
child:
Padding
(
padding:
EdgeInsets
.
all
(
100.0
),
child:
Text
(
'Hello World'
),
),
),
),
),
);
final
TestGesture
dragging
=
await
tester
.
startGesture
(
const
Offset
(
10
,
10
));
addTearDown
(
dragging
.
removePointer
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
await
dragging
.
moveTo
(
const
Offset
(
90
,
90
));
await
dragging
.
up
();
final
TestGesture
longpress
=
await
tester
.
startGesture
(
const
Offset
(
20
,
20
));
addTearDown
(
longpress
.
removePointer
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
await
longpress
.
up
();
expect
(
tester
.
takeException
(),
isNull
);
});
testWidgets
(
'builds the default context menu by default'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
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