Merge pull request #2455 from Hixie/MultiChildLayoutDelegate.performLayout
Remove the second argument to MultiChildLayoutDelegate.performLayout()
This commit is contained in:
commit
60ca6f1c33
@ -39,9 +39,8 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
|||||||
|
|
||||||
final EdgeDims padding;
|
final EdgeDims padding;
|
||||||
|
|
||||||
void performLayout(Size size, BoxConstraints constraints) {
|
void performLayout(Size size) {
|
||||||
|
BoxConstraints looseConstraints = new BoxConstraints.loose(size);
|
||||||
BoxConstraints looseConstraints = constraints.loosen();
|
|
||||||
|
|
||||||
// This part of the layout has the same effect as putting the toolbar and
|
// This part of the layout has the same effect as putting the toolbar and
|
||||||
// body in a column and making the body flexible. What's different is that
|
// body in a column and making the body flexible. What's different is that
|
||||||
|
@ -103,7 +103,7 @@ abstract class MultiChildLayoutDelegate {
|
|||||||
return '${childParentData.id}: $child';
|
return '${childParentData.id}: $child';
|
||||||
}
|
}
|
||||||
|
|
||||||
void _callPerformLayout(Size size, BoxConstraints constraints, RenderBox firstChild) {
|
void _callPerformLayout(Size size, RenderBox firstChild) {
|
||||||
// A particular layout delegate could be called reentrantly, e.g. if it used
|
// A particular layout delegate could be called reentrantly, e.g. if it used
|
||||||
// by both a parent and a child. So, we must restore the _idToChild map when
|
// by both a parent and a child. So, we must restore the _idToChild map when
|
||||||
// we return.
|
// we return.
|
||||||
@ -138,7 +138,7 @@ abstract class MultiChildLayoutDelegate {
|
|||||||
});
|
});
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
performLayout(size, constraints);
|
performLayout(size);
|
||||||
assert(() {
|
assert(() {
|
||||||
if (_debugChildrenNeedingLayout.isNotEmpty) {
|
if (_debugChildrenNeedingLayout.isNotEmpty) {
|
||||||
if (_debugChildrenNeedingLayout.length > 1) {
|
if (_debugChildrenNeedingLayout.length > 1) {
|
||||||
@ -176,11 +176,10 @@ abstract class MultiChildLayoutDelegate {
|
|||||||
/// possible given the constraints.
|
/// possible given the constraints.
|
||||||
Size getSize(BoxConstraints constraints) => constraints.biggest;
|
Size getSize(BoxConstraints constraints) => constraints.biggest;
|
||||||
|
|
||||||
/// Override this method to lay out and position all children given
|
/// Override this method to lay out and position all children given this
|
||||||
/// this widget's size and the specified constraints. This method
|
/// widget's size. This method must call [layoutChild] for each child. It
|
||||||
/// must call [layoutChild] for each child. It should also specify
|
/// should also specify the final position of each child with [positionChild].
|
||||||
/// the final position of each child with [positionChild].
|
void performLayout(Size size);
|
||||||
void performLayout(Size size, BoxConstraints constraints);
|
|
||||||
|
|
||||||
/// Override this method to return true when the children need to be
|
/// Override this method to return true when the children need to be
|
||||||
/// laid out. This should compare the fields of the current delegate
|
/// laid out. This should compare the fields of the current delegate
|
||||||
@ -257,7 +256,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
|
|||||||
}
|
}
|
||||||
|
|
||||||
void performLayout() {
|
void performLayout() {
|
||||||
delegate._callPerformLayout(size, constraints, firstChild);
|
delegate._callPerformLayout(size, firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void paint(PaintingContext context, Offset offset) {
|
void paint(PaintingContext context, Offset offset) {
|
||||||
|
@ -17,16 +17,15 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Size performLayoutSize;
|
Size performLayoutSize;
|
||||||
BoxConstraints performLayoutConstraints;
|
|
||||||
Size performLayoutSize0;
|
Size performLayoutSize0;
|
||||||
Size performLayoutSize1;
|
Size performLayoutSize1;
|
||||||
bool performLayoutIsChild;
|
bool performLayoutIsChild;
|
||||||
|
|
||||||
void performLayout(Size size, BoxConstraints constraints) {
|
void performLayout(Size size) {
|
||||||
assert(!RenderObject.debugCheckingIntrinsics);
|
assert(!RenderObject.debugCheckingIntrinsics);
|
||||||
expect(() {
|
expect(() {
|
||||||
performLayoutSize = size;
|
performLayoutSize = size;
|
||||||
performLayoutConstraints = constraints;
|
BoxConstraints constraints = new BoxConstraints.loose(size);
|
||||||
performLayoutSize0 = layoutChild(0, constraints);
|
performLayoutSize0 = layoutChild(0, constraints);
|
||||||
performLayoutSize1 = layoutChild(1, constraints);
|
performLayoutSize1 = layoutChild(1, constraints);
|
||||||
performLayoutIsChild = isChild('fred');
|
performLayoutIsChild = isChild('fred');
|
||||||
@ -68,10 +67,6 @@ void main() {
|
|||||||
|
|
||||||
expect(delegate.performLayoutSize.width, 200.0);
|
expect(delegate.performLayoutSize.width, 200.0);
|
||||||
expect(delegate.performLayoutSize.height, 300.0);
|
expect(delegate.performLayoutSize.height, 300.0);
|
||||||
expect(delegate.performLayoutConstraints.minWidth, 0.0);
|
|
||||||
expect(delegate.performLayoutConstraints.maxWidth, 800.0);
|
|
||||||
expect(delegate.performLayoutConstraints.minHeight, 0.0);
|
|
||||||
expect(delegate.performLayoutConstraints.maxHeight, 600.0);
|
|
||||||
expect(delegate.performLayoutSize0.width, 150.0);
|
expect(delegate.performLayoutSize0.width, 150.0);
|
||||||
expect(delegate.performLayoutSize0.height, 100.0);
|
expect(delegate.performLayoutSize0.height, 100.0);
|
||||||
expect(delegate.performLayoutSize1.width, 100.0);
|
expect(delegate.performLayoutSize1.width, 100.0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user