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
b26346f2
Unverified
Commit
b26346f2
authored
Jul 13, 2022
by
Christopher Fujino
Committed by
GitHub
Jul 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix null safe check in RenderIndexedStack (#107581)
parent
d949ca42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+1
-1
stack_test.dart
packages/flutter/test/rendering/stack_test.dart
+28
-0
No files found.
packages/flutter/lib/src/rendering/stack.dart
View file @
b26346f2
...
...
@@ -790,7 +790,7 @@ class RenderIndexedStack extends RenderStack {
while
(
child
!=
null
)
{
children
.
add
(
child
.
toDiagnosticsNode
(
name:
'child
${i + 1}
'
,
style:
i
!=
index
!
?
DiagnosticsTreeStyle
.
offstage
:
null
,
style:
i
!=
index
?
DiagnosticsTreeStyle
.
offstage
:
null
,
));
child
=
(
child
.
parentData
!
as
StackParentData
).
nextSibling
;
i
+=
1
;
...
...
packages/flutter/test/rendering/stack_test.dart
View file @
b26346f2
...
...
@@ -145,6 +145,34 @@ void main() {
expect
(
diagnosticNodes
[
2
].
name
,
'child 3'
);
expect
(
diagnosticNodes
[
2
].
style
,
DiagnosticsTreeStyle
.
sparse
);
});
test
(
'debugDescribeChildren handles a null index'
,
()
{
final
RenderBox
child1
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
final
RenderBox
child2
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
final
RenderBox
child3
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
final
RenderBox
stack
=
RenderIndexedStack
(
index:
null
,
children:
<
RenderBox
>[
child1
,
child2
,
child3
],
);
final
List
<
DiagnosticsNode
>
diagnosticNodes
=
stack
.
debugDescribeChildren
();
expect
(
diagnosticNodes
[
0
].
name
,
'child 1'
);
expect
(
diagnosticNodes
[
0
].
style
,
DiagnosticsTreeStyle
.
offstage
);
expect
(
diagnosticNodes
[
1
].
name
,
'child 2'
);
expect
(
diagnosticNodes
[
1
].
style
,
DiagnosticsTreeStyle
.
offstage
);
expect
(
diagnosticNodes
[
2
].
name
,
'child 3'
);
expect
(
diagnosticNodes
[
2
].
style
,
DiagnosticsTreeStyle
.
offstage
);
});
});
test
(
'Stack in Flex can layout with no children'
,
()
{
...
...
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