Index: sky/framework/components/fixed_height_scrollable.dart |
diff --git a/sky/framework/components/fixed_height_scrollable.dart b/sky/framework/components/fixed_height_scrollable.dart |
index 4f3a9d9116cc7d9af231266704b5f335f667e536..b388b17635a069551a24e4f200e482bec09a7d3b 100644 |
--- a/sky/framework/components/fixed_height_scrollable.dart |
+++ b/sky/framework/components/fixed_height_scrollable.dart |
@@ -4,6 +4,7 @@ |
import '../animation/scroll_curve.dart'; |
import '../fn.dart'; |
+import 'dart:math' as math; |
import 'dart:sky' as sky; |
import 'scrollable.dart'; |
@@ -52,17 +53,24 @@ abstract class FixedHeightScrollable extends Scrollable { |
var transformStyle = ''; |
if (_height > 0.0) { |
- drawCount = (_height / _itemHeight).round() + 1; |
- double alignmentDelta = -scrollOffset % _itemHeight; |
- if (alignmentDelta != 0.0) { |
- alignmentDelta -= _itemHeight; |
- } |
+ if (scrollOffset < 0.0) { |
+ double visibleHeight = _height + scrollOffset; |
+ drawCount = (visibleHeight / _itemHeight).round() + 1; |
+ transformStyle = |
+ 'transform: translateY(${(-scrollOffset).toStringAsFixed(2)}px)'; |
+ } else { |
+ drawCount = (_height / _itemHeight).round() + 1; |
+ double alignmentOffset = math.max(0.0, scrollOffset); |
+ double alignmentDelta = -scrollOffset % _itemHeight; |
+ if (alignmentDelta != 0.0) |
+ alignmentDelta -= _itemHeight; |
- double drawStart = scrollOffset + alignmentDelta; |
- itemNumber = (drawStart / _itemHeight).floor(); |
+ double drawStart = scrollOffset + alignmentDelta; |
+ itemNumber = (drawStart / _itemHeight).floor(); |
- transformStyle = |
- 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)'; |
+ transformStyle = |
+ 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)'; |
+ } |
} |
return new Container( |