Remove ScrollDirection.both
Almost none of the clients of ScrollDirection can handle scrolling in both directions. Fixes #151
This commit is contained in:
parent
24fadf49fc
commit
7aa575b0d4
@ -16,9 +16,6 @@ enum ScrollDirection {
|
|||||||
|
|
||||||
/// Scroll up and down
|
/// Scroll up and down
|
||||||
vertical,
|
vertical,
|
||||||
|
|
||||||
/// Scroll in all four cardinal directions
|
|
||||||
both
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A render object that's bigger on the inside.
|
/// A render object that's bigger on the inside.
|
||||||
@ -44,8 +41,6 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
|
|||||||
|
|
||||||
bool _offsetIsSane(Offset offset, ScrollDirection direction) {
|
bool _offsetIsSane(Offset offset, ScrollDirection direction) {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case ScrollDirection.both:
|
|
||||||
return true;
|
|
||||||
case ScrollDirection.horizontal:
|
case ScrollDirection.horizontal:
|
||||||
return offset.dy == 0.0;
|
return offset.dy == 0.0;
|
||||||
case ScrollDirection.vertical:
|
case ScrollDirection.vertical:
|
||||||
@ -84,9 +79,6 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
|
|||||||
BoxConstraints _getInnerConstraints(BoxConstraints constraints) {
|
BoxConstraints _getInnerConstraints(BoxConstraints constraints) {
|
||||||
BoxConstraints innerConstraints;
|
BoxConstraints innerConstraints;
|
||||||
switch (scrollDirection) {
|
switch (scrollDirection) {
|
||||||
case ScrollDirection.both:
|
|
||||||
innerConstraints = new BoxConstraints();
|
|
||||||
break;
|
|
||||||
case ScrollDirection.horizontal:
|
case ScrollDirection.horizontal:
|
||||||
innerConstraints = constraints.heightConstraints();
|
innerConstraints = constraints.heightConstraints();
|
||||||
break;
|
break;
|
||||||
|
@ -319,9 +319,6 @@ class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
|
|||||||
return childRenderObject.getMaxIntrinsicHeight(innerConstraints);
|
return childRenderObject.getMaxIntrinsicHeight(innerConstraints);
|
||||||
case ScrollDirection.horizontal:
|
case ScrollDirection.horizontal:
|
||||||
return childRenderObject.getMaxIntrinsicWidth(innerConstraints);
|
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<MixedViewport> {
|
|||||||
return new BoxConstraints.tightFor(width: constraints.constrainWidth());
|
return new BoxConstraints.tightFor(width: constraints.constrainWidth());
|
||||||
case ScrollDirection.horizontal:
|
case ScrollDirection.horizontal:
|
||||||
return new BoxConstraints.tightFor(height: constraints.constrainHeight());
|
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<MixedViewport> {
|
|||||||
'width (e.g. inside something else that scrolls horizontally), because it would then just eagerly build ' +
|
'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);
|
'all the children. You probably want to put the MixedViewport inside a Container with a fixed width.' is String);
|
||||||
break;
|
break;
|
||||||
case ScrollDirection.both: assert(false); // we don't support ScrollDirection.both, see issue 888
|
|
||||||
}
|
}
|
||||||
final double endOffset = widget.startOffset + extent;
|
final double endOffset = widget.startOffset + extent;
|
||||||
|
|
||||||
@ -523,7 +516,6 @@ class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
|
|||||||
case ScrollDirection.horizontal:
|
case ScrollDirection.horizontal:
|
||||||
renderObject.direction = BlockDirection.horizontal;
|
renderObject.direction = BlockDirection.horizontal;
|
||||||
break;
|
break;
|
||||||
case ScrollDirection.both: assert(false); // we don't support ScrollDirection.both, see issue 888
|
|
||||||
}
|
}
|
||||||
renderObject.startOffset = _childOffsets[index] - widget.startOffset;
|
renderObject.startOffset = _childOffsets[index] - widget.startOffset;
|
||||||
// Build all the widgets we still need.
|
// Build all the widgets we still need.
|
||||||
|
@ -91,9 +91,6 @@ abstract class Scrollable extends StatefulComponent {
|
|||||||
Point scrollableCenter = scrollableBox.localToGlobal(new Point(scrollableSize.width / 2.0, 0.0));
|
Point scrollableCenter = scrollableBox.localToGlobal(new Point(scrollableSize.width / 2.0, 0.0));
|
||||||
scrollOffsetDelta = targetCenter.x - scrollableCenter.x;
|
scrollOffsetDelta = targetCenter.x - scrollableCenter.x;
|
||||||
break;
|
break;
|
||||||
case ScrollDirection.both:
|
|
||||||
assert(false); // See https://github.com/flutter/engine/issues/888
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtentScrollBehavior scrollBehavior = scrollable.scrollBehavior;
|
ExtentScrollBehavior scrollBehavior = scrollable.scrollBehavior;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user