| Index: sky/sdk/lib/framework/components2/fixed_height_scrollable.dart
|
| diff --git a/sky/sdk/lib/framework/components2/fixed_height_scrollable.dart b/sky/sdk/lib/framework/components2/fixed_height_scrollable.dart
|
| index e3becda0128d251a40d925fc39ba52b8e2952ec5..5a52010f8c4d14fc0c1eb9d83ebc452b0cab9315 100644
|
| --- a/sky/sdk/lib/framework/components2/fixed_height_scrollable.dart
|
| +++ b/sky/sdk/lib/framework/components2/fixed_height_scrollable.dart
|
| @@ -10,16 +10,21 @@ import 'package:vector_math/vector_math.dart';
|
| import 'scrollable.dart';
|
|
|
| abstract class FixedHeightScrollable extends Scrollable {
|
| +
|
| FixedHeightScrollable({ this.itemHeight, Object key }) : super(key: key) {
|
| assert(itemHeight != null);
|
| }
|
|
|
| + double itemHeight;
|
| +
|
| + void syncFields(FixedHeightScrollable source) {
|
| + itemHeight = source.itemHeight;
|
| + super.syncFields(source);
|
| + }
|
| +
|
| ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
|
| OverscrollBehavior get scrollBehavior => super.scrollBehavior as OverscrollBehavior;
|
|
|
| - double _height;
|
| - final double itemHeight;
|
| -
|
| int _itemCount = 0;
|
| int get itemCount => _itemCount;
|
| void set itemCount (int value) {
|
| @@ -29,6 +34,7 @@ abstract class FixedHeightScrollable extends Scrollable {
|
| }
|
| }
|
|
|
| + double _height;
|
| void _handleSizeChanged(Size newSize) {
|
| setState(() {
|
| _height = newSize.height;
|
| @@ -37,24 +43,24 @@ abstract class FixedHeightScrollable extends Scrollable {
|
| }
|
|
|
| UINode buildContent() {
|
| - var itemNumber = 0;
|
| - var itemCount = 0;
|
| + var itemShowIndex = 0;
|
| + var itemShowCount = 0;
|
|
|
| Matrix4 transform = new Matrix4.identity();
|
|
|
| if (_height != null && _height > 0.0) {
|
| if (scrollOffset < 0.0) {
|
| double visibleHeight = _height + scrollOffset;
|
| - itemCount = (visibleHeight / itemHeight).round() + 1;
|
| + itemShowCount = (visibleHeight / itemHeight).round() + 1;
|
| transform.translate(0.0, -scrollOffset);
|
| } else {
|
| - itemCount = (_height / itemHeight).ceil() + 1;
|
| + itemShowCount = (_height / itemHeight).ceil() + 1;
|
| double alignmentDelta = -scrollOffset % itemHeight;
|
| if (alignmentDelta != 0.0)
|
| alignmentDelta -= itemHeight;
|
|
|
| double drawStart = scrollOffset + alignmentDelta;
|
| - itemNumber = math.max(0, (drawStart / itemHeight).floor());
|
| + itemShowIndex = math.max(0, (drawStart / itemHeight).floor());
|
|
|
| transform.translate(0.0, alignmentDelta);
|
| }
|
| @@ -70,7 +76,7 @@ abstract class FixedHeightScrollable extends Scrollable {
|
| child: new Transform(
|
| transform: transform,
|
| child: new BlockContainer(
|
| - children: buildItems(itemNumber, itemCount))
|
| + children: buildItems(itemShowIndex, itemShowCount))
|
| )
|
| )
|
| )
|
| @@ -78,4 +84,5 @@ abstract class FixedHeightScrollable extends Scrollable {
|
| }
|
|
|
| List<UINode> buildItems(int start, int count);
|
| +
|
| }
|
|
|