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
4e4887a9
Commit
4e4887a9
authored
Feb 10, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1763 from Hixie/asserts
More BoxConstraints asserts
parents
1e2e09ed
29654016
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
167 additions
and
89 deletions
+167
-89
block.dart
packages/flutter/lib/src/rendering/block.dart
+8
-8
box.dart
packages/flutter/lib/src/rendering/box.dart
+15
-0
custom_layout.dart
packages/flutter/lib/src/rendering/custom_layout.dart
+72
-9
editable_line.dart
packages/flutter/lib/src/rendering/editable_line.dart
+5
-5
flex.dart
packages/flutter/lib/src/rendering/flex.dart
+1
-1
grid.dart
packages/flutter/lib/src/rendering/grid.dart
+4
-4
image.dart
packages/flutter/lib/src/rendering/image.dart
+4
-4
list.dart
packages/flutter/lib/src/rendering/list.dart
+2
-2
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-1
overflow.dart
packages/flutter/lib/src/rendering/overflow.dart
+4
-4
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+3
-3
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+23
-23
shifted_box.dart
packages/flutter/lib/src/rendering/shifted_box.dart
+17
-17
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+4
-4
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+4
-4
No files found.
packages/flutter/lib/src/rendering/block.dart
View file @
4e4887a9
...
...
@@ -164,7 +164,7 @@ class RenderBlock extends RenderBlockBase {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
isVertical
)
{
return
_getIntrinsicCrossAxis
(
constraints
,
...
...
@@ -176,7 +176,7 @@ class RenderBlock extends RenderBlockBase {
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
isVertical
)
{
return
_getIntrinsicCrossAxis
(
constraints
,
...
...
@@ -188,7 +188,7 @@ class RenderBlock extends RenderBlockBase {
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
isVertical
)
return
_getIntrinsicMainAxis
(
constraints
,
constraints
.
constrainHeight
);
return
_getIntrinsicCrossAxis
(
...
...
@@ -199,7 +199,7 @@ class RenderBlock extends RenderBlockBase {
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
isVertical
)
return
_getIntrinsicMainAxis
(
constraints
,
constraints
.
constrainHeight
);
return
_getIntrinsicCrossAxis
(
...
...
@@ -367,28 +367,28 @@ class RenderBlockViewport extends RenderBlockBase {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
isVertical
)
return
_getIntrinsicDimension
(
constraints
,
minCrossAxisExtentCallback
,
constraints
.
constrainWidth
);
return
constraints
.
constrainWidth
(
minExtent
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
isVertical
)
return
_getIntrinsicDimension
(
constraints
,
maxCrossAxisExtentCallback
,
constraints
.
constrainWidth
);
return
_getIntrinsicDimension
(
constraints
,
totalExtentCallback
,
new
BoxConstraints
(
minWidth:
minExtent
).
enforce
(
constraints
).
constrainWidth
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(!
isVertical
)
return
_getIntrinsicDimension
(
constraints
,
minCrossAxisExtentCallback
,
constraints
.
constrainHeight
);
return
constraints
.
constrainHeight
(
0.0
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(!
isVertical
)
return
_getIntrinsicDimension
(
constraints
,
maxCrossAxisExtentCallback
,
constraints
.
constrainHeight
);
return
_getIntrinsicDimension
(
constraints
,
totalExtentCallback
,
new
BoxConstraints
(
minHeight:
minExtent
).
enforce
(
constraints
).
constrainHeight
);
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
4e4887a9
...
...
@@ -95,6 +95,21 @@ class BoxConstraints extends Constraints {
minHeight
=
height
!=
null
?
height
:
double
.
INFINITY
,
maxHeight
=
height
!=
null
?
height
:
double
.
INFINITY
;
/// Returns new box constraints that remove the minimum width and height requirements.
BoxConstraints
copyWith
({
double
minWidth
,
double
maxWidth
,
double
minHeight
,
double
maxHeight
})
{
return
new
BoxConstraints
(
minWidth:
minWidth
??
this
.
minWidth
,
maxWidth:
maxWidth
??
this
.
maxWidth
,
minHeight:
minHeight
??
this
.
minHeight
,
maxHeight:
maxHeight
??
this
.
maxHeight
);
}
/// Returns new box constraints that are smaller by the given edge dimensions.
BoxConstraints
deflate
(
EdgeDims
edges
)
{
assert
(
edges
!=
null
);
...
...
packages/flutter/lib/src/rendering/custom_layout.dart
View file @
4e4887a9
...
...
@@ -32,12 +32,32 @@ abstract class MultiChildLayoutDelegate {
/// the constraints parameter. The child's size is returned.
Size
layoutChild
(
Object
childId
,
BoxConstraints
constraints
)
{
final
RenderBox
child
=
_idToChild
[
childId
];
assert
(
child
!=
null
);
assert
(()
{
'A MultiChildLayoutDelegate cannot layout the same child more than once.'
;
return
_debugChildrenNeedingLayout
.
remove
(
child
);
if
(
child
==
null
)
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate tried to lay out a non-existent child:
\n
'
'There is no child with the id "
$childId
".'
);
}
if
(!
_debugChildrenNeedingLayout
.
remove
(
child
))
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate tried to lay out the child with id "
$childId
" more than once.
\n
'
'Each child must be laid out exactly once.'
);
}
try
{
assert
(
constraints
.
debugAssertIsNormalized
);
}
on
AssertionError
catch
(
exception
)
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate provided invalid box constraints for the child with id "
$childId
":
\n
'
'
$exception
\n
'
'The minimum width and height must be greater than or equal to zero.
\n
'
'The maximum width must be greater than or equal to the minimum width.
\n
'
'The maximum height must be greater than or equal to the minimum height.'
);
}
return
true
;
});
assert
(
constraints
.
isNormalized
);
child
.
layout
(
constraints
,
parentUsesSize:
true
);
return
child
.
size
;
}
...
...
@@ -45,11 +65,29 @@ abstract class MultiChildLayoutDelegate {
/// Specify the child's origin relative to this origin.
void
positionChild
(
Object
childId
,
Offset
offset
)
{
final
RenderBox
child
=
_idToChild
[
childId
];
assert
(
child
!=
null
);
assert
(()
{
if
(
child
==
null
)
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate tried to position out a non-existent child:
\n
'
'There is no child with the id "
$childId
".'
);
}
if
(
offset
==
null
)
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate provided a null position for the child with id "
$childId
".'
);
}
return
true
;
});
final
MultiChildLayoutParentData
childParentData
=
child
.
parentData
;
childParentData
.
offset
=
offset
;
}
String
_debugDescribeChild
(
RenderBox
child
)
{
final
MultiChildLayoutParentData
childParentData
=
child
.
parentData
;
return
'
${childParentData.id}
:
$child
'
;
}
void
_callPerformLayout
(
Size
size
,
BoxConstraints
constraints
,
RenderBox
firstChild
)
{
final
Map
<
Object
,
RenderBox
>
previousIdToChild
=
_idToChild
;
...
...
@@ -65,7 +103,16 @@ abstract class MultiChildLayoutDelegate {
RenderBox
child
=
firstChild
;
while
(
child
!=
null
)
{
final
MultiChildLayoutParentData
childParentData
=
child
.
parentData
;
assert
(
childParentData
.
id
!=
null
);
assert
(()
{
if
(
childParentData
.
id
==
null
)
{
throw
new
RenderingError
(
'The following child has no ID:
\n
'
'
$child
\n
'
'Every child of a RenderCustomMultiChildLayoutBox must have an ID in its parent data.'
);
}
return
true
;
});
_idToChild
[
childParentData
.
id
]
=
child
;
assert
(()
{
_debugChildrenNeedingLayout
.
add
(
child
);
...
...
@@ -75,8 +122,22 @@ abstract class MultiChildLayoutDelegate {
}
performLayout
(
size
,
constraints
);
assert
(()
{
'A MultiChildLayoutDelegate needs to call layoutChild on every child.'
;
return
_debugChildrenNeedingLayout
.
isEmpty
;
if
(
_debugChildrenNeedingLayout
.
isNotEmpty
)
{
if
(
_debugChildrenNeedingLayout
.
length
>
1
)
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate forgot to lay out the following children:
\n
'
'
${_debugChildrenNeedingLayout.map(_debugDescribeChild).join("\n ")}
\n
'
'Each child must be laid out exactly once.'
);
}
else
{
throw
new
RenderingError
(
'The
$this
custom multichild layout delegate forgot to lay out the following child:
\n
'
'
${_debugDescribeChild(_debugChildrenNeedingLayout.single)}
\n
'
'Each child must be laid out exactly once.'
);
}
}
return
true
;
});
}
finally
{
_idToChild
=
previousIdToChild
;
...
...
@@ -94,6 +155,8 @@ abstract class MultiChildLayoutDelegate {
/// constraints. This method must apply layoutChild() to each child. It should
/// specify the final position of each child with positionChild().
void
performLayout
(
Size
size
,
BoxConstraints
constraints
);
String
toString
()
=>
'
$runtimeType
'
;
}
/// Defers the layout of multiple children to a delegate.
...
...
@@ -131,7 +194,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
}
Size
_getSize
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrain
(
_delegate
.
getSize
(
constraints
));
}
...
...
packages/flutter/lib/src/rendering/editable_line.dart
View file @
4e4887a9
...
...
@@ -132,22 +132,22 @@ class RenderEditableLine extends RenderBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainWidth
(
0.0
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainWidth
(
0.0
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainHeight
(
_preferredHeight
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainHeight
(
_preferredHeight
);
}
...
...
@@ -183,7 +183,7 @@ class RenderEditableLine extends RenderBox {
// TODO(abarth): This logic should live in TextPainter and be shared with RenderParagraph.
void
_layoutText
(
BoxConstraints
constraints
)
{
assert
(
constraints
!=
null
);
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
_constraintsForCurrentLayout
==
constraints
)
return
;
// already cached this layout
_textPainter
.
maxWidth
=
constraints
.
maxWidth
;
...
...
packages/flutter/lib/src/rendering/flex.dart
View file @
4e4887a9
...
...
@@ -142,7 +142,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
double
_getIntrinsicSize
({
BoxConstraints
constraints
,
FlexDirection
sizingDirection
,
_ChildSizingFunction
childSize
})
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
// http://www.w3.org/TR/2015/WD-css-flexbox-1-20150514/#intrinsic-sizes
if
(
_direction
==
sizingDirection
)
{
// INTRINSIC MAIN SIZE
...
...
packages/flutter/lib/src/rendering/grid.dart
View file @
4e4887a9
...
...
@@ -371,22 +371,22 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_delegate
.
getMinIntrinsicWidth
(
constraints
,
virtualChildCount
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_delegate
.
getMaxIntrinsicWidth
(
constraints
,
virtualChildCount
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_delegate
.
getMinIntrinsicHeight
(
constraints
,
virtualChildCount
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_delegate
.
getMaxIntrinsicHeight
(
constraints
,
virtualChildCount
);
}
...
...
packages/flutter/lib/src/rendering/image.dart
View file @
4e4887a9
...
...
@@ -206,26 +206,26 @@ class RenderImage extends RenderBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
_width
==
null
&&
_height
==
null
)
return
constraints
.
constrainWidth
(
0.0
);
return
_sizeForConstraints
(
constraints
).
width
;
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_sizeForConstraints
(
constraints
).
width
;
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
_width
==
null
&&
_height
==
null
)
return
constraints
.
constrainHeight
(
0.0
);
return
_sizeForConstraints
(
constraints
).
height
;
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_sizeForConstraints
(
constraints
).
height
;
}
...
...
packages/flutter/lib/src/rendering/list.dart
View file @
4e4887a9
...
...
@@ -79,7 +79,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
}
double
_getIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
switch
(
scrollDirection
)
{
case
Axis
.
vertical
:
return
constraints
.
constrainWidth
(
0.0
);
...
...
@@ -97,7 +97,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
}
double
_getIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
switch
(
scrollDirection
)
{
case
Axis
.
vertical
:
return
constraints
.
constrainHeight
(
_preferredExtent
);
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
4e4887a9
...
...
@@ -740,8 +740,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
List
<
String
>
descendants
=
<
String
>[];
const
int
maxDepth
=
5
;
void
visitor
(
RenderObject
child
)
{
descendants
.
add
(
'
${" " * depth}$child
'
);
depth
+=
1
;
descendants
.
add
(
'
${" " * depth}$child
'
);
if
(
depth
<
maxDepth
)
child
.
visitChildren
(
visitor
);
depth
-=
1
;
...
...
packages/flutter/lib/src/rendering/overflow.dart
View file @
4e4887a9
...
...
@@ -29,22 +29,22 @@ class RenderSizedOverflowBox extends RenderBox with RenderObjectWithChildMixin<R
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainWidth
(
_requestedSize
.
width
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainWidth
(
_requestedSize
.
width
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainHeight
(
_requestedSize
.
height
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
constrainHeight
(
_requestedSize
.
height
);
}
...
...
packages/flutter/lib/src/rendering/paragraph.dart
View file @
4e4887a9
...
...
@@ -46,7 +46,7 @@ class RenderParagraph extends RenderBox {
// TODO(abarth): This logic should live in TextPainter and be shared with RenderEditableLine.
void
_layoutText
(
BoxConstraints
constraints
)
{
assert
(
constraints
!=
null
);
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
_constraintsForCurrentLayout
==
constraints
)
return
;
// already cached this layout
_textPainter
.
maxWidth
=
constraints
.
maxWidth
;
...
...
@@ -78,12 +78,12 @@ class RenderParagraph extends RenderBox {
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_getIntrinsicHeight
(
constraints
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_getIntrinsicHeight
(
constraints
);
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
4e4887a9
...
...
@@ -39,28 +39,28 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicWidth
(
constraints
);
return
super
.
getMinIntrinsicWidth
(
constraints
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicWidth
(
constraints
);
return
super
.
getMaxIntrinsicWidth
(
constraints
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicHeight
(
constraints
);
return
super
.
getMinIntrinsicHeight
(
constraints
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicHeight
(
constraints
);
return
super
.
getMaxIntrinsicHeight
(
constraints
);
...
...
@@ -162,7 +162,7 @@ class RenderConstrainedBox extends RenderProxyBox {
BoxConstraints
additionalConstraints
})
:
_additionalConstraints
=
additionalConstraints
,
super
(
child
)
{
assert
(
additionalConstraints
!=
null
);
assert
(
additionalConstraints
.
i
sNormalized
);
assert
(
additionalConstraints
.
debugAssertI
sNormalized
);
}
/// Additional constraints to apply to [child] during layout
...
...
@@ -170,7 +170,7 @@ class RenderConstrainedBox extends RenderProxyBox {
BoxConstraints
_additionalConstraints
;
void
set
additionalConstraints
(
BoxConstraints
newConstraints
)
{
assert
(
newConstraints
!=
null
);
assert
(
newConstraints
.
i
sNormalized
);
assert
(
newConstraints
.
debugAssertI
sNormalized
);
if
(
_additionalConstraints
==
newConstraints
)
return
;
_additionalConstraints
=
newConstraints
;
...
...
@@ -178,28 +178,28 @@ class RenderConstrainedBox extends RenderProxyBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicWidth
(
_additionalConstraints
.
enforce
(
constraints
));
return
_additionalConstraints
.
enforce
(
constraints
).
constrainWidth
(
0.0
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicWidth
(
_additionalConstraints
.
enforce
(
constraints
));
return
_additionalConstraints
.
enforce
(
constraints
).
constrainWidth
(
0.0
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicHeight
(
_additionalConstraints
.
enforce
(
constraints
));
return
_additionalConstraints
.
enforce
(
constraints
).
constrainHeight
(
0.0
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicHeight
(
_additionalConstraints
.
enforce
(
constraints
));
return
_additionalConstraints
.
enforce
(
constraints
).
constrainHeight
(
0.0
);
...
...
@@ -306,28 +306,28 @@ class RenderFractionallySizedBox extends RenderProxyBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicWidth
(
_getInnerConstraints
(
constraints
));
return
_getInnerConstraints
(
constraints
).
constrainWidth
(
0.0
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicWidth
(
_getInnerConstraints
(
constraints
));
return
_getInnerConstraints
(
constraints
).
constrainWidth
(
0.0
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicHeight
(
_getInnerConstraints
(
constraints
));
return
_getInnerConstraints
(
constraints
).
constrainHeight
(
0.0
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicHeight
(
_getInnerConstraints
(
constraints
));
return
_getInnerConstraints
(
constraints
).
constrainHeight
(
0.0
);
...
...
@@ -396,7 +396,7 @@ class RenderAspectRatio extends RenderProxyBox {
}
Size
_applyAspectRatio
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
width
=
constraints
.
constrainWidth
();
double
height
=
constraints
.
constrainHeight
(
width
/
_aspectRatio
);
return
new
Size
(
width
,
height
);
...
...
@@ -475,12 +475,12 @@ class RenderIntrinsicWidth extends RenderProxyBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
getMaxIntrinsicWidth
(
constraints
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
==
null
)
return
constraints
.
constrainWidth
(
0.0
);
double
childResult
=
child
.
getMaxIntrinsicWidth
(
constraints
);
...
...
@@ -488,7 +488,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
==
null
)
return
constraints
.
constrainHeight
(
0.0
);
double
childResult
=
child
.
getMinIntrinsicHeight
(
_getInnerConstraints
(
constraints
));
...
...
@@ -496,7 +496,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
==
null
)
return
constraints
.
constrainHeight
(
0.0
);
double
childResult
=
child
.
getMaxIntrinsicHeight
(
_getInnerConstraints
(
constraints
));
...
...
@@ -545,26 +545,26 @@ class RenderIntrinsicHeight extends RenderProxyBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
==
null
)
return
constraints
.
constrainWidth
(
0.0
);
return
child
.
getMinIntrinsicWidth
(
_getInnerConstraints
(
constraints
));
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
==
null
)
return
constraints
.
constrainWidth
(
0.0
);
return
child
.
getMaxIntrinsicWidth
(
_getInnerConstraints
(
constraints
));
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
getMaxIntrinsicHeight
(
constraints
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
==
null
)
return
constraints
.
constrainHeight
(
0.0
);
return
child
.
getMaxIntrinsicHeight
(
constraints
);
...
...
packages/flutter/lib/src/rendering/shifted_box.dart
View file @
4e4887a9
...
...
@@ -19,28 +19,28 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicWidth
(
constraints
);
return
super
.
getMinIntrinsicWidth
(
constraints
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicWidth
(
constraints
);
return
super
.
getMaxIntrinsicWidth
(
constraints
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMinIntrinsicHeight
(
constraints
);
return
super
.
getMinIntrinsicHeight
(
constraints
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
child
.
getMaxIntrinsicHeight
(
constraints
);
return
super
.
getMaxIntrinsicHeight
(
constraints
);
...
...
@@ -107,7 +107,7 @@ class RenderPadding extends RenderShiftedBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
totalPadding
=
padding
.
left
+
padding
.
right
;
if
(
child
!=
null
)
return
constraints
.
constrainWidth
(
child
.
getMinIntrinsicWidth
(
constraints
.
deflate
(
padding
))
+
totalPadding
);
...
...
@@ -115,7 +115,7 @@ class RenderPadding extends RenderShiftedBox {
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
totalPadding
=
padding
.
left
+
padding
.
right
;
if
(
child
!=
null
)
return
constraints
.
constrainWidth
(
child
.
getMaxIntrinsicWidth
(
constraints
.
deflate
(
padding
))
+
totalPadding
);
...
...
@@ -123,7 +123,7 @@ class RenderPadding extends RenderShiftedBox {
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
totalPadding
=
padding
.
top
+
padding
.
bottom
;
if
(
child
!=
null
)
return
constraints
.
constrainHeight
(
child
.
getMinIntrinsicHeight
(
constraints
.
deflate
(
padding
))
+
totalPadding
);
...
...
@@ -131,7 +131,7 @@ class RenderPadding extends RenderShiftedBox {
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
totalPadding
=
padding
.
top
+
padding
.
bottom
;
if
(
child
!=
null
)
return
constraints
.
constrainHeight
(
child
.
getMaxIntrinsicHeight
(
constraints
.
deflate
(
padding
))
+
totalPadding
);
...
...
@@ -465,22 +465,22 @@ class RenderOverflowBox extends RenderShiftedBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
minWidth
;
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
minWidth
;
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
minHeight
;
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
constraints
.
minHeight
;
}
...
...
@@ -554,22 +554,22 @@ class RenderCustomOneChildLayoutBox extends RenderShiftedBox {
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_getSize
(
constraints
).
width
;
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_getSize
(
constraints
).
width
;
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_getSize
(
constraints
).
height
;
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
return
_getSize
(
constraints
).
height
;
}
...
...
@@ -582,7 +582,7 @@ class RenderCustomOneChildLayoutBox extends RenderShiftedBox {
void
performLayout
()
{
if
(
child
!=
null
)
{
BoxConstraints
childConstraints
=
delegate
.
getConstraintsForChild
(
constraints
);
assert
(
childConstraints
.
i
sNormalized
);
assert
(
childConstraints
.
debugAssertI
sNormalized
);
child
.
layout
(
childConstraints
,
parentUsesSize:
!
childConstraints
.
isTight
);
final
BoxParentData
childParentData
=
child
.
parentData
;
childParentData
.
offset
=
delegate
.
getPositionForChild
(
size
,
childConstraints
.
isTight
?
childConstraints
.
smallest
:
child
.
size
);
...
...
packages/flutter/lib/src/rendering/stack.dart
View file @
4e4887a9
...
...
@@ -220,7 +220,7 @@ abstract class RenderStackBase extends RenderBox
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
width
=
constraints
.
minWidth
;
RenderBox
child
=
firstChild
;
while
(
child
!=
null
)
{
...
...
@@ -235,7 +235,7 @@ abstract class RenderStackBase extends RenderBox
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
bool
hasNonPositionedChildren
=
false
;
double
width
=
constraints
.
minWidth
;
RenderBox
child
=
firstChild
;
...
...
@@ -255,7 +255,7 @@ abstract class RenderStackBase extends RenderBox
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
double
height
=
constraints
.
minHeight
;
RenderBox
child
=
firstChild
;
while
(
child
!=
null
)
{
...
...
@@ -270,7 +270,7 @@ abstract class RenderStackBase extends RenderBox
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
bool
hasNonPositionedChildren
=
false
;
double
height
=
constraints
.
minHeight
;
RenderBox
child
=
firstChild
;
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
4e4887a9
...
...
@@ -195,28 +195,28 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin<
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
constraints
.
constrainWidth
(
child
.
getMinIntrinsicWidth
(
_getInnerConstraints
(
constraints
)));
return
super
.
getMinIntrinsicWidth
(
constraints
);
}
double
getMaxIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
constraints
.
constrainWidth
(
child
.
getMaxIntrinsicWidth
(
_getInnerConstraints
(
constraints
)));
return
super
.
getMaxIntrinsicWidth
(
constraints
);
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
constraints
.
constrainHeight
(
child
.
getMinIntrinsicHeight
(
_getInnerConstraints
(
constraints
)));
return
super
.
getMinIntrinsicHeight
(
constraints
);
}
double
getMaxIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
i
sNormalized
);
assert
(
constraints
.
debugAssertI
sNormalized
);
if
(
child
!=
null
)
return
constraints
.
constrainHeight
(
child
.
getMaxIntrinsicHeight
(
_getInnerConstraints
(
constraints
)));
return
super
.
getMaxIntrinsicHeight
(
constraints
);
...
...
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