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
c1809717
Unverified
Commit
c1809717
authored
May 07, 2022
by
Bruno Leroux
Committed by
GitHub
May 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty Stack with infinite constraints throws (#102642)
parent
ae7fcc7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+1
-2
stack_test.dart
packages/flutter/test/rendering/stack_test.dart
+25
-0
No files found.
packages/flutter/lib/src/rendering/stack.dart
View file @
c1809717
...
@@ -520,8 +520,7 @@ class RenderStack extends RenderBox
...
@@ -520,8 +520,7 @@ class RenderStack extends RenderBox
assert
(
_resolvedAlignment
!=
null
);
assert
(
_resolvedAlignment
!=
null
);
bool
hasNonPositionedChildren
=
false
;
bool
hasNonPositionedChildren
=
false
;
if
(
childCount
==
0
)
{
if
(
childCount
==
0
)
{
assert
(
constraints
.
biggest
.
isFinite
);
return
(
constraints
.
biggest
.
isFinite
)
?
constraints
.
biggest
:
constraints
.
smallest
;
return
constraints
.
biggest
;
}
}
double
width
=
constraints
.
minWidth
;
double
width
=
constraints
.
minWidth
;
...
...
packages/flutter/test/rendering/stack_test.dart
View file @
c1809717
...
@@ -148,5 +148,30 @@ void main() {
...
@@ -148,5 +148,30 @@ void main() {
});
});
});
});
test
(
'Stack in Flex can layout with no children'
,
()
{
// Render an empty Stack in a Flex
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
<
RenderBox
>[
RenderStack
(
textDirection:
TextDirection
.
ltr
,
children:
<
RenderBox
>[],
),
]
);
bool
stackFlutterErrorThrown
=
false
;
layout
(
flex
,
constraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
onErrors:
()
{
stackFlutterErrorThrown
=
true
;
}
);
expect
(
stackFlutterErrorThrown
,
false
);
});
// More tests in ../widgets/stack_test.dart
// More tests in ../widgets/stack_test.dart
}
}
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