From 7aa575b0d4fa869f4a10e4555dfaf4b49d14158b Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Mon, 4 Jan 2016 16:46:40 -0800 Subject: [PATCH] Remove ScrollDirection.both Almost none of the clients of ScrollDirection can handle scrolling in both directions. Fixes #151 --- packages/flutter/lib/src/rendering/viewport.dart | 8 -------- packages/flutter/lib/src/widgets/mixed_viewport.dart | 8 -------- packages/flutter/lib/src/widgets/scrollable.dart | 3 --- 3 files changed, 19 deletions(-) diff --git a/packages/flutter/lib/src/rendering/viewport.dart b/packages/flutter/lib/src/rendering/viewport.dart index 10b002bbf9..90b405a2b1 100644 --- a/packages/flutter/lib/src/rendering/viewport.dart +++ b/packages/flutter/lib/src/rendering/viewport.dart @@ -16,9 +16,6 @@ enum ScrollDirection { /// Scroll up and down vertical, - - /// Scroll in all four cardinal directions - both } /// A render object that's bigger on the inside. @@ -44,8 +41,6 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin { return childRenderObject.getMaxIntrinsicHeight(innerConstraints); case ScrollDirection.horizontal: return childRenderObject.getMaxIntrinsicWidth(innerConstraints); - case ScrollDirection.both: - assert(false); // we don't support ScrollDirection.both, see issue 888 - return double.NAN; } } @@ -331,9 +328,6 @@ class _MixedViewportElement extends RenderObjectElement { return new BoxConstraints.tightFor(width: constraints.constrainWidth()); case ScrollDirection.horizontal: return new BoxConstraints.tightFor(height: constraints.constrainHeight()); - case ScrollDirection.both: - assert(false); // we don't support ScrollDirection.both, see issue 888 - return null; } } @@ -373,7 +367,6 @@ class _MixedViewportElement extends RenderObjectElement { 'width (e.g. inside something else that scrolls horizontally), because it would then just eagerly build ' + 'all the children. You probably want to put the MixedViewport inside a Container with a fixed width.' is String); break; - case ScrollDirection.both: assert(false); // we don't support ScrollDirection.both, see issue 888 } final double endOffset = widget.startOffset + extent; @@ -523,7 +516,6 @@ class _MixedViewportElement extends RenderObjectElement { case ScrollDirection.horizontal: renderObject.direction = BlockDirection.horizontal; break; - case ScrollDirection.both: assert(false); // we don't support ScrollDirection.both, see issue 888 } renderObject.startOffset = _childOffsets[index] - widget.startOffset; // Build all the widgets we still need. diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index c8044ef965..4a2dc0d7d1 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -91,9 +91,6 @@ abstract class Scrollable extends StatefulComponent { Point scrollableCenter = scrollableBox.localToGlobal(new Point(scrollableSize.width / 2.0, 0.0)); scrollOffsetDelta = targetCenter.x - scrollableCenter.x; break; - case ScrollDirection.both: - assert(false); // See https://github.com/flutter/engine/issues/888 - break; } ExtentScrollBehavior scrollBehavior = scrollable.scrollBehavior;