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
1a5639d3
Commit
1a5639d3
authored
Dec 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #707 from abarth/tiny_flex
RenderFlex shouldn't assert when its out of space
parents
ab74b178
7e474f6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
4 deletions
+44
-4
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+2
-4
flex_test.dart
packages/unit/test/widget/flex_test.dart
+42
-0
No files found.
packages/flutter/lib/src/rendering/flex.dart
View file @
1a5639d3
...
...
@@ -466,14 +466,12 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
case
FlexDirection
.
horizontal
:
size
=
constraints
.
constrain
(
new
Size
(
_overflow
,
crossSize
));
crossSize
=
size
.
height
;
assert
(
size
.
width
>=
_overflow
);
remainingSpace
=
size
.
width
-
_overflow
;
remainingSpace
=
math
.
max
(
0.0
,
size
.
width
-
_overflow
);
break
;
case
FlexDirection
.
vertical
:
size
=
constraints
.
constrain
(
new
Size
(
crossSize
,
_overflow
));
crossSize
=
size
.
width
;
assert
(
size
.
height
>=
_overflow
);
remainingSpace
=
size
.
height
-
_overflow
;
remainingSpace
=
math
.
max
(
0.0
,
size
.
height
-
_overflow
);
break
;
}
_overflow
=
0.0
;
...
...
packages/unit/test/widget/flex_test.dart
View file @
1a5639d3
...
...
@@ -108,4 +108,46 @@ void main() {
expect
(
renderBox
.
size
.
height
,
equals
(
250.0
));
});
});
test
(
'Can layout at zero size'
,
()
{
final
Key
childKey
=
new
Key
(
'childKey'
);
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Center
(
child:
new
Container
(
width:
0.0
,
height:
0.0
,
child:
new
Column
([
new
Container
(
key:
childKey
,
width:
100.0
,
height:
100.0
)],
justifyContent:
FlexJustifyContent
.
collapse
)
)
));
RenderBox
renderBox
=
tester
.
findElementByKey
(
childKey
).
renderObject
;
expect
(
renderBox
.
size
.
width
,
equals
(
0.0
));
expect
(
renderBox
.
size
.
height
,
equals
(
100.0
));
tester
.
pumpWidget
(
new
Center
(
child:
new
Container
(
width:
0.0
,
height:
0.0
,
child:
new
Row
([
new
Container
(
key:
childKey
,
width:
100.0
,
height:
100.0
)],
justifyContent:
FlexJustifyContent
.
collapse
)
)
));
renderBox
=
tester
.
findElementByKey
(
childKey
).
renderObject
;
expect
(
renderBox
.
size
.
width
,
equals
(
100.0
));
expect
(
renderBox
.
size
.
height
,
equals
(
0.0
));
});
});
}
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