Commit d78b78c4 authored by Adam Barth's avatar Adam Barth

[rename fixit] scrollAnchor -> anchor

parent e9b8f445
...@@ -19,6 +19,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -19,6 +19,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
int virtualChildCount, int virtualChildCount,
Offset paintOffset: Offset.zero, Offset paintOffset: Offset.zero,
Axis mainAxis: Axis.vertical, Axis mainAxis: Axis.vertical,
ViewportAnchor anchor: ViewportAnchor.start,
Painter overlayPainter, Painter overlayPainter,
LayoutCallback callback LayoutCallback callback
}) : _itemExtent = itemExtent, }) : _itemExtent = itemExtent,
...@@ -27,6 +28,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -27,6 +28,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
virtualChildCount: virtualChildCount, virtualChildCount: virtualChildCount,
paintOffset: paintOffset, paintOffset: paintOffset,
mainAxis: mainAxis, mainAxis: mainAxis,
anchor: anchor,
overlayPainter: overlayPainter, overlayPainter: overlayPainter,
callback: callback callback: callback
) { ) {
......
...@@ -85,11 +85,11 @@ class RenderViewportBase extends RenderBox implements HasMainAxis { ...@@ -85,11 +85,11 @@ class RenderViewportBase extends RenderBox implements HasMainAxis {
RenderViewportBase( RenderViewportBase(
Offset paintOffset, Offset paintOffset,
Axis mainAxis, Axis mainAxis,
ViewportAnchor scrollAnchor, ViewportAnchor anchor,
Painter overlayPainter Painter overlayPainter
) : _paintOffset = paintOffset, ) : _paintOffset = paintOffset,
_mainAxis = mainAxis, _mainAxis = mainAxis,
_scrollAnchor = scrollAnchor, _anchor = anchor,
_overlayPainter = overlayPainter { _overlayPainter = overlayPainter {
assert(paintOffset != null); assert(paintOffset != null);
assert(mainAxis != null); assert(mainAxis != null);
...@@ -139,13 +139,13 @@ class RenderViewportBase extends RenderBox implements HasMainAxis { ...@@ -139,13 +139,13 @@ class RenderViewportBase extends RenderBox implements HasMainAxis {
/// The end of the viewport from which the paint offset is computed. /// The end of the viewport from which the paint offset is computed.
/// ///
/// See [ViewportAnchor] for more detail. /// See [ViewportAnchor] for more detail.
ViewportAnchor get scrollAnchor => _scrollAnchor; ViewportAnchor get anchor => _anchor;
ViewportAnchor _scrollAnchor; ViewportAnchor _anchor;
void set scrollAnchor(ViewportAnchor value) { void set anchor(ViewportAnchor value) {
assert(value != null); assert(value != null);
if (value == _scrollAnchor) if (value == _anchor)
return; return;
_scrollAnchor = value; _anchor = value;
markNeedsPaint(); markNeedsPaint();
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
} }
...@@ -186,7 +186,7 @@ class RenderViewportBase extends RenderBox implements HasMainAxis { ...@@ -186,7 +186,7 @@ class RenderViewportBase extends RenderBox implements HasMainAxis {
int dyInDevicePixels = (_paintOffset.dy * devicePixelRatio).round(); int dyInDevicePixels = (_paintOffset.dy * devicePixelRatio).round();
return _dimensions.getAbsolutePaintOffset( return _dimensions.getAbsolutePaintOffset(
paintOffset: new Offset(dxInDevicePixels / devicePixelRatio, dyInDevicePixels / devicePixelRatio), paintOffset: new Offset(dxInDevicePixels / devicePixelRatio, dyInDevicePixels / devicePixelRatio),
anchor: _scrollAnchor anchor: _anchor
); );
} }
...@@ -199,7 +199,7 @@ class RenderViewportBase extends RenderBox implements HasMainAxis { ...@@ -199,7 +199,7 @@ class RenderViewportBase extends RenderBox implements HasMainAxis {
super.debugFillDescription(description); super.debugFillDescription(description);
description.add('paintOffset: $paintOffset'); description.add('paintOffset: $paintOffset');
description.add('mainAxis: $mainAxis'); description.add('mainAxis: $mainAxis');
description.add('scrollAnchor: $scrollAnchor'); description.add('anchor: $anchor');
if (overlayPainter != null) if (overlayPainter != null)
description.add('overlay painter: $overlayPainter'); description.add('overlay painter: $overlayPainter');
} }
...@@ -219,10 +219,10 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin< ...@@ -219,10 +219,10 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin<
RenderBox child, RenderBox child,
Offset paintOffset: Offset.zero, Offset paintOffset: Offset.zero,
Axis mainAxis: Axis.vertical, Axis mainAxis: Axis.vertical,
ViewportAnchor scrollAnchor: ViewportAnchor.start, ViewportAnchor anchor: ViewportAnchor.start,
Painter overlayPainter, Painter overlayPainter,
this.onPaintOffsetUpdateNeeded this.onPaintOffsetUpdateNeeded
}) : super(paintOffset, mainAxis, scrollAnchor, overlayPainter) { }) : super(paintOffset, mainAxis, anchor, overlayPainter) {
this.child = child; this.child = child;
} }
...@@ -339,11 +339,11 @@ abstract class RenderVirtualViewport<T extends ContainerBoxParentDataMixin<Rende ...@@ -339,11 +339,11 @@ abstract class RenderVirtualViewport<T extends ContainerBoxParentDataMixin<Rende
LayoutCallback callback, LayoutCallback callback,
Offset paintOffset: Offset.zero, Offset paintOffset: Offset.zero,
Axis mainAxis: Axis.vertical, Axis mainAxis: Axis.vertical,
ViewportAnchor scrollAnchor: ViewportAnchor.start, ViewportAnchor anchor: ViewportAnchor.start,
Painter overlayPainter Painter overlayPainter
}) : _virtualChildCount = virtualChildCount, }) : _virtualChildCount = virtualChildCount,
_callback = callback, _callback = callback,
super(paintOffset, mainAxis, scrollAnchor, overlayPainter); super(paintOffset, mainAxis, anchor, overlayPainter);
int get virtualChildCount => _virtualChildCount; int get virtualChildCount => _virtualChildCount;
int _virtualChildCount; int _virtualChildCount;
......
...@@ -833,7 +833,7 @@ class Viewport extends OneChildRenderObjectWidget { ...@@ -833,7 +833,7 @@ class Viewport extends OneChildRenderObjectWidget {
Key key, Key key,
this.paintOffset: Offset.zero, this.paintOffset: Offset.zero,
this.mainAxis: Axis.vertical, this.mainAxis: Axis.vertical,
this.scrollAnchor: ViewportAnchor.start, this.anchor: ViewportAnchor.start,
this.overlayPainter, this.overlayPainter,
this.onPaintOffsetUpdateNeeded, this.onPaintOffsetUpdateNeeded,
Widget child Widget child
...@@ -854,7 +854,7 @@ class Viewport extends OneChildRenderObjectWidget { ...@@ -854,7 +854,7 @@ class Viewport extends OneChildRenderObjectWidget {
/// that direction (e.g., the child can be as tall as it wants). /// that direction (e.g., the child can be as tall as it wants).
final Axis mainAxis; final Axis mainAxis;
final ViewportAnchor scrollAnchor; final ViewportAnchor anchor;
/// Paints an overlay over the viewport. /// Paints an overlay over the viewport.
/// ///
...@@ -867,7 +867,7 @@ class Viewport extends OneChildRenderObjectWidget { ...@@ -867,7 +867,7 @@ class Viewport extends OneChildRenderObjectWidget {
return new RenderViewport( return new RenderViewport(
paintOffset: paintOffset, paintOffset: paintOffset,
mainAxis: mainAxis, mainAxis: mainAxis,
scrollAnchor: scrollAnchor, anchor: anchor,
onPaintOffsetUpdateNeeded: onPaintOffsetUpdateNeeded, onPaintOffsetUpdateNeeded: onPaintOffsetUpdateNeeded,
overlayPainter: overlayPainter overlayPainter: overlayPainter
); );
...@@ -877,7 +877,7 @@ class Viewport extends OneChildRenderObjectWidget { ...@@ -877,7 +877,7 @@ class Viewport extends OneChildRenderObjectWidget {
// Order dependency: RenderViewport validates scrollOffset based on mainAxis. // Order dependency: RenderViewport validates scrollOffset based on mainAxis.
renderObject renderObject
..mainAxis = mainAxis ..mainAxis = mainAxis
..scrollAnchor = scrollAnchor ..anchor = anchor
..paintOffset = paintOffset ..paintOffset = paintOffset
..onPaintOffsetUpdateNeeded = onPaintOffsetUpdateNeeded ..onPaintOffsetUpdateNeeded = onPaintOffsetUpdateNeeded
..overlayPainter = overlayPainter; ..overlayPainter = overlayPainter;
......
...@@ -166,7 +166,7 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> { ...@@ -166,7 +166,7 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
return new PageViewport( return new PageViewport(
itemsWrap: config.itemsWrap, itemsWrap: config.itemsWrap,
mainAxis: config.scrollDirection, mainAxis: config.scrollDirection,
scrollAnchor: config.scrollAnchor, anchor: config.scrollAnchor,
startOffset: scrollOffset, startOffset: scrollOffset,
overlayPainter: config.scrollableListPainter, overlayPainter: config.scrollableListPainter,
children: config.children children: config.children
...@@ -227,7 +227,7 @@ class PageViewport extends VirtualViewportFromIterable { ...@@ -227,7 +227,7 @@ class PageViewport extends VirtualViewportFromIterable {
PageViewport({ PageViewport({
this.startOffset: 0.0, this.startOffset: 0.0,
this.mainAxis: Axis.vertical, this.mainAxis: Axis.vertical,
this.scrollAnchor: ViewportAnchor.start, this.anchor: ViewportAnchor.start,
this.itemsWrap: false, this.itemsWrap: false,
this.overlayPainter, this.overlayPainter,
this.children this.children
...@@ -237,7 +237,7 @@ class PageViewport extends VirtualViewportFromIterable { ...@@ -237,7 +237,7 @@ class PageViewport extends VirtualViewportFromIterable {
final double startOffset; final double startOffset;
final Axis mainAxis; final Axis mainAxis;
final ViewportAnchor scrollAnchor; final ViewportAnchor anchor;
final bool itemsWrap; final bool itemsWrap;
final Painter overlayPainter; final Painter overlayPainter;
final Iterable<Widget> children; final Iterable<Widget> children;
...@@ -326,7 +326,7 @@ class _PageViewportElement extends VirtualViewportElement { ...@@ -326,7 +326,7 @@ class _PageViewportElement extends VirtualViewportElement {
_materializedChildCount = limitItem - startItem; _materializedChildCount = limitItem - startItem;
_startOffsetBase = startItem.toDouble(); _startOffsetBase = startItem.toDouble();
_startOffsetLimit = (limitItem - 1).toDouble(); _startOffsetLimit = (limitItem - 1).toDouble();
if (widget.scrollAnchor == ViewportAnchor.end) if (widget.anchor == ViewportAnchor.end)
_materializedChildBase = (length - _materializedChildBase - _materializedChildCount) % length; _materializedChildBase = (length - _materializedChildBase - _materializedChildCount) % length;
} }
......
...@@ -658,7 +658,7 @@ class _ScrollableViewportState extends ScrollableState<ScrollableViewport> { ...@@ -658,7 +658,7 @@ class _ScrollableViewportState extends ScrollableState<ScrollableViewport> {
return new Viewport( return new Viewport(
paintOffset: scrollOffsetToPixelDelta(scrollOffset), paintOffset: scrollOffsetToPixelDelta(scrollOffset),
mainAxis: config.scrollDirection, mainAxis: config.scrollDirection,
scrollAnchor: config.scrollAnchor, anchor: config.scrollAnchor,
onPaintOffsetUpdateNeeded: _handlePaintOffsetUpdateNeeded, onPaintOffsetUpdateNeeded: _handlePaintOffsetUpdateNeeded,
child: config.child child: config.child
); );
......
...@@ -79,7 +79,7 @@ class _ScrollableListState extends ScrollableState<ScrollableList> { ...@@ -79,7 +79,7 @@ class _ScrollableListState extends ScrollableState<ScrollableList> {
onExtentsChanged: _handleExtentsChanged, onExtentsChanged: _handleExtentsChanged,
scrollOffset: scrollOffset, scrollOffset: scrollOffset,
mainAxis: config.scrollDirection, mainAxis: config.scrollDirection,
scrollAnchor: config.scrollAnchor, anchor: config.scrollAnchor,
itemExtent: config.itemExtent, itemExtent: config.itemExtent,
itemsWrap: config.itemsWrap, itemsWrap: config.itemsWrap,
padding: config.padding, padding: config.padding,
...@@ -94,7 +94,7 @@ class _VirtualListViewport extends VirtualViewport { ...@@ -94,7 +94,7 @@ class _VirtualListViewport extends VirtualViewport {
this.onExtentsChanged, this.onExtentsChanged,
this.scrollOffset, this.scrollOffset,
this.mainAxis, this.mainAxis,
this.scrollAnchor, this.anchor,
this.itemExtent, this.itemExtent,
this.itemsWrap, this.itemsWrap,
this.padding, this.padding,
...@@ -107,7 +107,7 @@ class _VirtualListViewport extends VirtualViewport { ...@@ -107,7 +107,7 @@ class _VirtualListViewport extends VirtualViewport {
final ExtentsChangedCallback onExtentsChanged; final ExtentsChangedCallback onExtentsChanged;
final double scrollOffset; final double scrollOffset;
final Axis mainAxis; final Axis mainAxis;
final ViewportAnchor scrollAnchor; final ViewportAnchor anchor;
final double itemExtent; final double itemExtent;
final bool itemsWrap; final bool itemsWrap;
final EdgeDims padding; final EdgeDims padding;
...@@ -116,7 +116,7 @@ class _VirtualListViewport extends VirtualViewport { ...@@ -116,7 +116,7 @@ class _VirtualListViewport extends VirtualViewport {
double get _leadingPadding { double get _leadingPadding {
switch (mainAxis) { switch (mainAxis) {
case Axis.vertical: case Axis.vertical:
switch (scrollAnchor) { switch (anchor) {
case ViewportAnchor.start: case ViewportAnchor.start:
return padding.top; return padding.top;
case ViewportAnchor.end: case ViewportAnchor.end:
...@@ -124,7 +124,7 @@ class _VirtualListViewport extends VirtualViewport { ...@@ -124,7 +124,7 @@ class _VirtualListViewport extends VirtualViewport {
} }
break; break;
case Axis.horizontal: case Axis.horizontal:
switch (scrollAnchor) { switch (anchor) {
case ViewportAnchor.start: case ViewportAnchor.start:
return padding.left; return padding.left;
case ViewportAnchor.end: case ViewportAnchor.end:
...@@ -167,7 +167,7 @@ class _VirtualListViewportElement extends VirtualViewportElement { ...@@ -167,7 +167,7 @@ class _VirtualListViewportElement extends VirtualViewportElement {
void updateRenderObject(_VirtualListViewport oldWidget) { void updateRenderObject(_VirtualListViewport oldWidget) {
renderObject renderObject
..mainAxis = widget.mainAxis ..mainAxis = widget.mainAxis
..scrollAnchor = widget.scrollAnchor ..anchor = widget.anchor
..itemExtent = widget.itemExtent ..itemExtent = widget.itemExtent
..padding = widget.padding ..padding = widget.padding
..overlayPainter = widget.overlayPainter; ..overlayPainter = widget.overlayPainter;
...@@ -217,7 +217,7 @@ class _VirtualListViewportElement extends VirtualViewportElement { ...@@ -217,7 +217,7 @@ class _VirtualListViewportElement extends VirtualViewportElement {
_startOffsetBase = startItem * itemExtent; _startOffsetBase = startItem * itemExtent;
_startOffsetLimit = limitItem * itemExtent - containerExtent; _startOffsetLimit = limitItem * itemExtent - containerExtent;
if (widget.scrollAnchor == ViewportAnchor.end) if (widget.anchor == ViewportAnchor.end)
_materializedChildBase = (length - _materializedChildBase - _materializedChildCount) % length; _materializedChildBase = (length - _materializedChildBase - _materializedChildCount) % length;
} }
...@@ -247,7 +247,7 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable ...@@ -247,7 +247,7 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable
ExtentsChangedCallback onExtentsChanged, ExtentsChangedCallback onExtentsChanged,
double scrollOffset: 0.0, double scrollOffset: 0.0,
Axis mainAxis: Axis.vertical, Axis mainAxis: Axis.vertical,
ViewportAnchor scrollAnchor: ViewportAnchor.start, ViewportAnchor anchor: ViewportAnchor.start,
double itemExtent, double itemExtent,
bool itemsWrap: false, bool itemsWrap: false,
EdgeDims padding, EdgeDims padding,
...@@ -257,7 +257,7 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable ...@@ -257,7 +257,7 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable
onExtentsChanged, onExtentsChanged,
scrollOffset, scrollOffset,
mainAxis, mainAxis,
scrollAnchor, anchor,
itemExtent, itemExtent,
itemsWrap, itemsWrap,
padding, padding,
...@@ -342,7 +342,7 @@ class _ScrollableLazyListState extends ScrollableState<ScrollableLazyList> { ...@@ -342,7 +342,7 @@ class _ScrollableLazyListState extends ScrollableState<ScrollableLazyList> {
onExtentsChanged: _handleExtentsChanged, onExtentsChanged: _handleExtentsChanged,
scrollOffset: scrollOffset, scrollOffset: scrollOffset,
mainAxis: config.scrollDirection, mainAxis: config.scrollDirection,
scrollAnchor: config.scrollAnchor, anchor: config.scrollAnchor,
itemExtent: config.itemExtent, itemExtent: config.itemExtent,
itemCount: config.itemCount, itemCount: config.itemCount,
itemBuilder: config.itemBuilder, itemBuilder: config.itemBuilder,
...@@ -357,7 +357,7 @@ class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuil ...@@ -357,7 +357,7 @@ class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuil
ExtentsChangedCallback onExtentsChanged, ExtentsChangedCallback onExtentsChanged,
double scrollOffset: 0.0, double scrollOffset: 0.0,
Axis mainAxis: Axis.vertical, Axis mainAxis: Axis.vertical,
ViewportAnchor scrollAnchor: ViewportAnchor.start, ViewportAnchor anchor: ViewportAnchor.start,
double itemExtent, double itemExtent,
EdgeDims padding, EdgeDims padding,
Painter overlayPainter, Painter overlayPainter,
...@@ -367,7 +367,7 @@ class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuil ...@@ -367,7 +367,7 @@ class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuil
onExtentsChanged, onExtentsChanged,
scrollOffset, scrollOffset,
mainAxis, mainAxis,
scrollAnchor, anchor,
itemExtent, itemExtent,
false, // Don't support wrapping yet. false, // Don't support wrapping yet.
padding, padding,
......
...@@ -51,7 +51,7 @@ abstract class VirtualViewportElement extends RenderObjectElement { ...@@ -51,7 +51,7 @@ abstract class VirtualViewportElement extends RenderObjectElement {
/// Returns the pixel offset for a scroll offset, accounting for the scroll /// Returns the pixel offset for a scroll offset, accounting for the scroll
/// anchor. /// anchor.
double scrollOffsetToPixelOffset(double scrollOffset) { double scrollOffsetToPixelOffset(double scrollOffset) {
switch (renderObject.scrollAnchor) { switch (renderObject.anchor) {
case ViewportAnchor.start: case ViewportAnchor.start:
return -scrollOffset; return -scrollOffset;
case ViewportAnchor.end: case ViewportAnchor.end:
......
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