Commit 6bef1736 authored by Ian Hickson's avatar Ian Hickson

Remove the second argument to MultiChildLayoutDelegate.performLayout()

Fixes https://github.com/flutter/flutter/issues/2403

I have an e-mail ready to send to flutter-dev about this.
parent f64101ab
......@@ -39,9 +39,8 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
final EdgeDims padding;
void performLayout(Size size, BoxConstraints constraints) {
BoxConstraints looseConstraints = constraints.loosen();
void performLayout(Size size) {
BoxConstraints looseConstraints = new BoxConstraints.loose(size);
// 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
......
......@@ -103,7 +103,7 @@ abstract class MultiChildLayoutDelegate {
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
// by both a parent and a child. So, we must restore the _idToChild map when
// we return.
......@@ -138,7 +138,7 @@ abstract class MultiChildLayoutDelegate {
});
child = childParentData.nextSibling;
}
performLayout(size, constraints);
performLayout(size);
assert(() {
if (_debugChildrenNeedingLayout.isNotEmpty) {
if (_debugChildrenNeedingLayout.length > 1) {
......@@ -176,11 +176,10 @@ abstract class MultiChildLayoutDelegate {
/// possible given the constraints.
Size getSize(BoxConstraints constraints) => constraints.biggest;
/// Override this method to lay out and position all children given
/// this widget's size and the specified constraints. This method
/// must call [layoutChild] for each child. It should also specify
/// the final position of each child with [positionChild].
void performLayout(Size size, BoxConstraints constraints);
/// Override this method to lay out and position all children given this
/// widget's size. This method must call [layoutChild] for each child. It
/// should also specify the final position of each child with [positionChild].
void performLayout(Size size);
/// Override this method to return true when the children need to be
/// laid out. This should compare the fields of the current delegate
......@@ -257,7 +256,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
}
void performLayout() {
delegate._callPerformLayout(size, constraints, firstChild);
delegate._callPerformLayout(size, firstChild);
}
void paint(PaintingContext context, Offset offset) {
......
......@@ -17,16 +17,15 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate {
}
Size performLayoutSize;
BoxConstraints performLayoutConstraints;
Size performLayoutSize0;
Size performLayoutSize1;
bool performLayoutIsChild;
void performLayout(Size size, BoxConstraints constraints) {
void performLayout(Size size) {
assert(!RenderObject.debugCheckingIntrinsics);
expect(() {
performLayoutSize = size;
performLayoutConstraints = constraints;
BoxConstraints constraints = new BoxConstraints.loose(size);
performLayoutSize0 = layoutChild(0, constraints);
performLayoutSize1 = layoutChild(1, constraints);
performLayoutIsChild = isChild('fred');
......@@ -68,10 +67,6 @@ void main() {
expect(delegate.performLayoutSize.width, 200.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.height, 100.0);
expect(delegate.performLayoutSize1.width, 100.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment