| Index: sky/sdk/lib/widgets/fixed_height_scrollable.dart
|
| diff --git a/sky/sdk/lib/widgets/fixed_height_scrollable.dart b/sky/sdk/lib/widgets/fixed_height_scrollable.dart
|
| index 1a0997cf7f1ce1e7f1971e643ce2fda49c1b65f9..81cdb20cc9b8c82926eb107271572e3f1eeee935 100644
|
| --- a/sky/sdk/lib/widgets/fixed_height_scrollable.dart
|
| +++ b/sky/sdk/lib/widgets/fixed_height_scrollable.dart
|
| @@ -12,16 +12,20 @@ import 'scrollable.dart';
|
|
|
| abstract class FixedHeightScrollable extends Scrollable {
|
|
|
| - final EdgeDims padding;
|
| -
|
| FixedHeightScrollable({ String key, this.itemHeight, Color backgroundColor, this.padding })
|
| : super(key: key, backgroundColor: backgroundColor) {
|
| assert(itemHeight != null);
|
| }
|
|
|
| + EdgeDims padding;
|
| double itemHeight;
|
|
|
| + /// Subclasses must implement `get itemCount` to tell FixedHeightScrollable
|
| + /// how many items there are in the list.
|
| + int get itemCount;
|
| +
|
| void syncFields(FixedHeightScrollable source) {
|
| + padding = source.padding;
|
| itemHeight = source.itemHeight;
|
| super.syncFields(source);
|
| }
|
| @@ -29,18 +33,6 @@ abstract class FixedHeightScrollable extends Scrollable {
|
| ScrollBehavior createScrollBehavior() => new OverscrollBehavior();
|
| OverscrollBehavior get scrollBehavior => super.scrollBehavior;
|
|
|
| - int _itemCount = 0;
|
| - int get itemCount => _itemCount;
|
| - void set itemCount (int value) {
|
| - if (_itemCount != value) {
|
| - _itemCount = value;
|
| - double contentsHeight = itemHeight * _itemCount;
|
| - if (padding != null)
|
| - contentsHeight += padding.top + padding.bottom;
|
| - scrollBehavior.contentsHeight = contentsHeight;
|
| - }
|
| - }
|
| -
|
| double _height;
|
| void _handleSizeChanged(Size newSize) {
|
| setState(() {
|
| @@ -57,10 +49,18 @@ abstract class FixedHeightScrollable extends Scrollable {
|
| return super.scrollTo(newScrollOffset);
|
| }
|
|
|
| + void _updateContentsHeight() {
|
| + double contentsHeight = itemHeight * itemCount;
|
| + if (padding != null)
|
| + contentsHeight += padding.top + padding.bottom;
|
| + scrollBehavior.contentsHeight = contentsHeight;
|
| + }
|
| +
|
| Widget buildContent() {
|
| + _updateContentsHeight();
|
| +
|
| var itemShowIndex = 0;
|
| var itemShowCount = 0;
|
| -
|
| Matrix4 transform = new Matrix4.identity();
|
|
|
| if (_height != null && _height > 0.0) {
|
|
|