Commit 19f615fc authored by Adam Barth's avatar Adam Barth

[rename fixit] MultiChildLayoutDelegate#isChild -> hasChild

Fixes #459
parent 44c4e930
......@@ -51,12 +51,12 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
double contentTop = padding.top;
double contentBottom = size.height - padding.bottom;
if (isChild(_ScaffoldSlot.toolBar)) {
if (hasChild(_ScaffoldSlot.toolBar)) {
contentTop = layoutChild(_ScaffoldSlot.toolBar, fullWidthConstraints).height;
positionChild(_ScaffoldSlot.toolBar, Offset.zero);
}
if (isChild(_ScaffoldSlot.body)) {
if (hasChild(_ScaffoldSlot.body)) {
final double bodyHeight = contentBottom - contentTop;
final BoxConstraints bodyConstraints = fullWidthConstraints.tighten(height: bodyHeight);
layoutChild(_ScaffoldSlot.body, bodyConstraints);
......@@ -75,17 +75,17 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
Size bottomSheetSize = Size.zero;
Size snackBarSize = Size.zero;
if (isChild(_ScaffoldSlot.bottomSheet)) {
if (hasChild(_ScaffoldSlot.bottomSheet)) {
bottomSheetSize = layoutChild(_ScaffoldSlot.bottomSheet, fullWidthConstraints);
positionChild(_ScaffoldSlot.bottomSheet, new Offset((size.width - bottomSheetSize.width) / 2.0, contentBottom - bottomSheetSize.height));
}
if (isChild(_ScaffoldSlot.snackBar)) {
if (hasChild(_ScaffoldSlot.snackBar)) {
snackBarSize = layoutChild(_ScaffoldSlot.snackBar, fullWidthConstraints);
positionChild(_ScaffoldSlot.snackBar, new Offset(0.0, contentBottom - snackBarSize.height));
}
if (isChild(_ScaffoldSlot.floatingActionButton)) {
if (hasChild(_ScaffoldSlot.floatingActionButton)) {
final Size fabSize = layoutChild(_ScaffoldSlot.floatingActionButton, looseConstraints);
final double fabX = size.width - fabSize.width - _kFloatingActionButtonMargin;
double fabY = contentBottom - fabSize.height - _kFloatingActionButtonMargin;
......@@ -96,7 +96,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
positionChild(_ScaffoldSlot.floatingActionButton, new Offset(fabX, fabY));
}
if (isChild(_ScaffoldSlot.drawer)) {
if (hasChild(_ScaffoldSlot.drawer)) {
layoutChild(_ScaffoldSlot.drawer, new BoxConstraints.tight(size));
positionChild(_ScaffoldSlot.drawer, Offset.zero);
}
......
......@@ -32,7 +32,7 @@ abstract class MultiChildLayoutDelegate {
/// Call this from the [performLayout] or [getSize] methods to
/// determine which children are available, if the child list might
/// vary.
bool isChild(Object childId) => _idToChild[childId] != null;
bool hasChild(Object childId) => _idToChild[childId] != null;
/// Ask the child to update its layout within the limits specified by
/// the constraints parameter. The child's size is returned.
......
......@@ -28,7 +28,7 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate {
BoxConstraints constraints = new BoxConstraints.loose(size);
performLayoutSize0 = layoutChild(0, constraints);
performLayoutSize1 = layoutChild(1, constraints);
performLayoutIsChild = isChild('fred');
performLayoutIsChild = hasChild('fred');
}, returnsNormally);
}
......
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