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
e4a14e56
Commit
e4a14e56
authored
Nov 06, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash if no widthFactor is set in an unbounded context
parent
5cf258c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
shifted_box.dart
packages/flutter/lib/src/rendering/shifted_box.dart
+4
-4
align_test.dart
packages/unit/test/widget/align_test.dart
+23
-0
No files found.
packages/flutter/lib/src/rendering/shifted_box.dart
View file @
e4a14e56
...
...
@@ -192,13 +192,13 @@ class RenderPositionedBox extends RenderShiftedBox {
}
void
performLayout
()
{
final
bool
shrinkWrapWidth
=
widthFactor
!=
null
||
constraints
.
maxWidth
==
double
.
INFINITY
;
final
bool
shrinkWrapHeight
=
heightFactor
!=
null
||
constraints
.
maxHeight
==
double
.
INFINITY
;
final
bool
shrinkWrapWidth
=
_
widthFactor
!=
null
||
constraints
.
maxWidth
==
double
.
INFINITY
;
final
bool
shrinkWrapHeight
=
_
heightFactor
!=
null
||
constraints
.
maxHeight
==
double
.
INFINITY
;
if
(
child
!=
null
)
{
child
.
layout
(
constraints
.
loosen
(),
parentUsesSize:
true
);
size
=
constraints
.
constrain
(
new
Size
(
shrinkWrapWidth
?
child
.
size
.
width
*
_widthFactor
:
double
.
INFINITY
,
shrinkWrapHeight
?
child
.
size
.
height
*
_heightFactor
:
double
.
INFINITY
));
size
=
constraints
.
constrain
(
new
Size
(
shrinkWrapWidth
?
child
.
size
.
width
*
(
_widthFactor
??
1.0
)
:
double
.
INFINITY
,
shrinkWrapHeight
?
child
.
size
.
height
*
(
_heightFactor
??
1.0
)
:
double
.
INFINITY
));
final
Offset
delta
=
size
-
child
.
size
;
final
BoxParentData
childParentData
=
child
.
parentData
;
childParentData
.
position
=
delta
.
scale
(
_alignment
.
x
,
_alignment
.
y
).
toPoint
();
...
...
packages/unit/test/widget/align_test.dart
View file @
e4a14e56
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:test/test.dart'
;
...
...
@@ -21,4 +22,26 @@ void main() {
);
});
});
test
(
'Shrink wraps in finite space'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
GlobalKey
alignKey
=
new
GlobalKey
();
tester
.
pumpWidget
(
new
ScrollableViewport
(
child:
new
Align
(
key:
alignKey
,
child:
new
Container
(
width:
10.0
,
height:
10.0
),
alignment:
const
FractionalOffset
(
0.50
,
0.50
)
)
)
);
RenderBox
box
=
alignKey
.
currentContext
.
findRenderObject
();
expect
(
box
.
size
.
width
,
equals
(
800.0
));
expect
(
box
.
size
.
height
,
equals
(
10.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