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
4e5acef6
Unverified
Commit
4e5acef6
authored
Mar 20, 2018
by
Jacob Richman
Committed by
GitHub
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the inspector handle widgets with non-invertible transforms gracefully. (#15761)
parent
19ef85bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
widget_inspector.dart
packages/flutter/lib/src/widgets/widget_inspector.dart
+8
-1
widget_inspector_test.dart
packages/flutter/test/widgets/widget_inspector_test.dart
+25
-0
No files found.
packages/flutter/lib/src/widgets/widget_inspector.dart
View file @
4e5acef6
...
...
@@ -564,7 +564,14 @@ class _WidgetInspectorState extends State<WidgetInspector>
Matrix4
transform
,
)
{
bool
hit
=
false
;
final
Matrix4
inverse
=
new
Matrix4
.
inverted
(
transform
);
Matrix4
inverse
;
try
{
inverse
=
new
Matrix4
.
inverted
(
transform
);
}
on
ArgumentError
{
// We cannot invert the transform. That means the object doesn't appear on
// screen and cannot be hit.
return
false
;
}
final
Offset
localPosition
=
MatrixUtils
.
transformPoint
(
inverse
,
position
);
final
List
<
DiagnosticsNode
>
children
=
object
.
debugDescribeChildren
();
...
...
packages/flutter/test/widgets/widget_inspector_test.dart
View file @
4e5acef6
...
...
@@ -117,6 +117,31 @@ void main() {
expect
(
paragraphText
(
getInspectorState
().
selection
.
current
),
equals
(
'BOTTOM'
));
});
testWidgets
(
'WidgetInspector non-invertible transform regression test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
WidgetInspector
(
selectButtonBuilder:
null
,
child:
new
Transform
(
transform:
new
Matrix4
.
identity
()..
scale
(
0.0
),
child:
new
Stack
(
children:
const
<
Widget
>[
const
Text
(
'a'
,
textDirection:
TextDirection
.
ltr
),
const
Text
(
'b'
,
textDirection:
TextDirection
.
ltr
),
const
Text
(
'c'
,
textDirection:
TextDirection
.
ltr
),
],
),
),
),
),
);
await
tester
.
tap
(
find
.
byType
(
Transform
));
expect
(
true
,
isTrue
);
// Expect that we reach here without crashing.
});
testWidgets
(
'WidgetInspector scroll test'
,
(
WidgetTester
tester
)
async
{
final
Key
childKey
=
new
UniqueKey
();
final
GlobalKey
selectButtonKey
=
new
GlobalKey
();
...
...
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