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
ebf71f59
Commit
ebf71f59
authored
Sep 16, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1191 from Hixie/flex
FlexAlignItems.stretch didn't stretch
parents
a15b27d4
07e010de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
3 deletions
+61
-3
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+2
-2
flex_test.dart
packages/unit/test/rendering/flex_test.dart
+59
-1
No files found.
packages/flutter/lib/src/rendering/flex.dart
View file @
ebf71f59
...
...
@@ -358,11 +358,11 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if
(
alignItems
==
FlexAlignItems
.
stretch
)
{
switch
(
_direction
)
{
case
FlexDirection
.
horizontal
:
innerConstraints
=
new
BoxConstraints
(
minHeight:
constraints
.
m
in
Height
,
innerConstraints
=
new
BoxConstraints
(
minHeight:
constraints
.
m
ax
Height
,
maxHeight:
constraints
.
maxHeight
);
break
;
case
FlexDirection
.
vertical
:
innerConstraints
=
new
BoxConstraints
(
minWidth:
constraints
.
m
in
Width
,
innerConstraints
=
new
BoxConstraints
(
minWidth:
constraints
.
m
ax
Width
,
maxWidth:
constraints
.
maxWidth
);
break
;
}
...
...
packages/unit/test/rendering/flex_test.dart
View file @
ebf71f59
...
...
@@ -8,9 +8,67 @@ void main() {
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
));
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"
);
});
test
(
'Defaults'
,
()
{
RenderFlex
flex
=
new
RenderFlex
();
expect
(
flex
.
alignItems
,
equals
(
FlexAlignItems
.
center
));
expect
(
flex
.
direction
,
equals
(
FlexDirection
.
horizontal
));
});
test
(
'Parent data'
,
()
{
RenderDecoratedBox
box1
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box2
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderFlex
flex
=
new
RenderFlex
(
children:
[
box1
,
box2
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
)
);
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
0.0
));
expect
(
box2
.
size
.
height
,
equals
(
0.0
));
box2
.
parentData
.
flex
=
1
;
flex
.
markNeedsLayout
();
pumpFrame
();
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
expect
(
box2
.
size
.
height
,
equals
(
0.0
));
});
test
(
'Stretch'
,
()
{
RenderDecoratedBox
box1
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box2
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderFlex
flex
=
new
RenderFlex
();
flex
.
setupParentData
(
box2
);
box2
.
parentData
.
flex
=
2
;
flex
.
addAll
([
box1
,
box2
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
)
);
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
expect
(
box2
.
size
.
height
,
equals
(
0.0
));
flex
.
alignItems
=
FlexAlignItems
.
stretch
;
pumpFrame
();
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
100.0
));
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
expect
(
box2
.
size
.
height
,
equals
(
100.0
));
flex
.
direction
=
FlexDirection
.
vertical
;
pumpFrame
();
expect
(
box1
.
size
.
width
,
equals
(
100.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
expect
(
box2
.
size
.
height
,
equals
(
100.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