From 19f615fc2fe13462c9ef1d2f4f2858e5f39fba27 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 12 Mar 2016 11:12:34 -0800 Subject: [PATCH] [rename fixit] MultiChildLayoutDelegate#isChild -> hasChild Fixes #459 --- packages/flutter/lib/src/material/scaffold.dart | 12 ++++++------ .../flutter/lib/src/rendering/custom_layout.dart | 2 +- .../test/widget/custom_multi_child_layout_test.dart | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index faf0d64cb4..2db2fb2727 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -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); } diff --git a/packages/flutter/lib/src/rendering/custom_layout.dart b/packages/flutter/lib/src/rendering/custom_layout.dart index 88c481f975..a4fde6d362 100644 --- a/packages/flutter/lib/src/rendering/custom_layout.dart +++ b/packages/flutter/lib/src/rendering/custom_layout.dart @@ -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. diff --git a/packages/flutter/test/widget/custom_multi_child_layout_test.dart b/packages/flutter/test/widget/custom_multi_child_layout_test.dart index bf3e208e56..9b741c896d 100644 --- a/packages/flutter/test/widget/custom_multi_child_layout_test.dart +++ b/packages/flutter/test/widget/custom_multi_child_layout_test.dart @@ -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); }