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
7cc694e5
Unverified
Commit
7cc694e5
authored
Feb 13, 2019
by
Jonah Williams
Committed by
GitHub
Feb 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track InheritedElement dependencies in diagnostic properties (#27387)
parent
aa8f8613
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
10 deletions
+65
-10
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+6
-0
inherited_dependencies_test.dart
...ges/flutter/test/widgets/inherited_dependencies_test.dart
+49
-0
table_test.dart
packages/flutter/test/widgets/table_test.dart
+10
-10
No files found.
packages/flutter/lib/src/widgets/framework.dart
View file @
7cc694e5
...
...
@@ -3431,6 +3431,12 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
widget
.
debugFillProperties
(
properties
);
}
properties
.
add
(
FlagProperty
(
'dirty'
,
value:
dirty
,
ifTrue:
'dirty'
));
if
(
_dependencies
!=
null
&&
_dependencies
.
isNotEmpty
)
{
final
List
<
DiagnosticsNode
>
diagnosticsDependencies
=
_dependencies
.
map
((
InheritedElement
element
)
=>
element
.
widget
.
toDiagnosticsNode
(
style:
DiagnosticsTreeStyle
.
sparse
))
.
toList
();
properties
.
add
(
DiagnosticsProperty
<
List
<
DiagnosticsNode
>>(
'dependencies'
,
diagnosticsDependencies
));
}
}
@override
...
...
packages/flutter/test/widgets/inherited_dependencies_test.dart
0 → 100644
View file @
7cc694e5
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/src/widgets/basic.dart'
;
import
'package:flutter/src/widgets/framework.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'InheritedWidget dependencies show up in diagnostic properties'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
key
=
GlobalKey
();
await
tester
.
pumpWidget
(
Directionality
(
key:
key
,
textDirection:
TextDirection
.
ltr
,
child:
Builder
(
builder:
(
BuildContext
context
)
{
Directionality
.
of
(
context
);
return
const
SizedBox
();
}),
));
final
InheritedElement
element
=
key
.
currentContext
;
expect
(
element
.
toStringDeep
(
minLevel:
DiagnosticLevel
.
info
),
equalsIgnoringHashCodes
(
'Directionality-[GlobalKey#00000](textDirection: ltr)
\n
'
'└Builder(dependencies: [Directionality-[GlobalKey#00000]])
\n
'
' └SizedBox(renderObject: RenderConstrainedBox#00000)
\n
'
''
),
);
await
tester
.
pumpWidget
(
Directionality
(
key:
key
,
textDirection:
TextDirection
.
rtl
,
child:
Builder
(
builder:
(
BuildContext
context
)
{
Directionality
.
of
(
context
);
return
const
SizedBox
();
}),
));
expect
(
element
.
toStringDeep
(
minLevel:
DiagnosticLevel
.
info
),
equalsIgnoringHashCodes
(
'Directionality-[GlobalKey#00000](textDirection: rtl)
\n
'
'└Builder(dependencies: [Directionality-[GlobalKey#00000]])
\n
'
' └SizedBox(renderObject: RenderConstrainedBox#00000)
\n
'
''
),
);
});
}
packages/flutter/test/widgets/table_test.dart
View file @
7cc694e5
...
...
@@ -796,25 +796,25 @@ void main() {
expect
(
element
.
toStringDeep
(
minLevel:
DiagnosticLevel
.
info
),
equalsIgnoringHashCodes
(
'Table-[GlobalKey#00000](renderObject: RenderTable#00000)
\n
'
'Table-[GlobalKey#00000](
dependencies: [Directionality],
renderObject: RenderTable#00000)
\n
'
'├Text("A")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "A", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "A",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("B")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "B", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "B",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("C")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "C", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "C",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("D")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "D", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "D",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("EEE")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "EEE", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "EEE",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("F")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "F", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "F",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("G")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "G", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "G",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'├Text("H")
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "H", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'│└RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "H",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
'└Text("III")
\n
'
' └RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "III", renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
' └RichText(softWrap: wrapping at box width, maxLines: unlimited, text: "III",
dependencies: [Directionality],
renderObject: RenderParagraph#00000 relayoutBoundary=up1)
\n
'
),
);
});
...
...
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