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
c2ee2db5
Commit
c2ee2db5
authored
Sep 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1041 from abarth/overconstrainted_flex
RenderFlex should handle overconstrainted constraints
parents
671b2bfe
2473346f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+1
-1
flex_test.dart
packages/unit/test/rendering/flex_test.dart
+16
-0
No files found.
packages/flutter/lib/src/rendering/flex.dart
View file @
c2ee2db5
...
...
@@ -295,7 +295,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
int
totalFlex
=
0
;
int
totalChildren
=
0
;
assert
(
constraints
!=
null
);
final
double
mainSize
=
(
_direction
==
FlexDirection
.
horizontal
)
?
constraints
.
maxWidth
:
constraints
.
maxHeight
;
final
double
mainSize
=
(
_direction
==
FlexDirection
.
horizontal
)
?
constraints
.
constrainWidth
()
:
constraints
.
constrainHeight
()
;
final
bool
canFlex
=
mainSize
<
double
.
INFINITY
;
double
crossSize
=
0.0
;
// This is determined as we lay out the children
double
freeSpace
=
canFlex
?
mainSize
:
0.0
;
...
...
packages/unit/test/rendering/flex_test.dart
0 → 100644
View file @
c2ee2db5
import
'package:sky/rendering.dart'
;
import
'package:test/test.dart'
;
import
'rendering_tester.dart'
;
void
main
(
)
{
test
(
'Overconstrained flex'
,
()
{
RenderDecoratedBox
box
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderFlex
flex
=
new
RenderFlex
(
children:
[
box
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
200.0
,
maxWidth:
100.0
,
minHeight:
200.0
,
maxHeight:
100.0
));
expect
(
flex
.
size
.
width
,
equals
(
200.0
),
reason:
"flex width"
);
expect
(
flex
.
size
.
height
,
equals
(
200.0
),
reason:
"flex height"
);
});
}
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