| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import '../animation/scroll_behavior.dart'; | 5 import '../animation/scroll_behavior.dart'; |
| 6 import '../fn.dart'; | 6 import '../fn.dart'; |
| 7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
| 9 import 'scrollable.dart'; | 9 import 'scrollable.dart'; |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 sky.ClientRect itemRect = item.getBoundingClientRect(); | 40 sky.ClientRect itemRect = item.getBoundingClientRect(); |
| 41 assert(scrollRect.height > 0); | 41 assert(scrollRect.height > 0); |
| 42 assert(itemRect.height > 0); | 42 assert(itemRect.height > 0); |
| 43 | 43 |
| 44 setState(() { | 44 setState(() { |
| 45 _height = scrollRect.height; | 45 _height = scrollRect.height; |
| 46 _itemHeight = itemRect.height; | 46 _itemHeight = itemRect.height; |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 | 49 |
| 50 Node build() { | 50 Node buildContent() { |
| 51 var itemNumber = 0; | 51 var itemNumber = 0; |
| 52 var drawCount = 1; | 52 var drawCount = 1; |
| 53 var transformStyle = ''; | 53 var transformStyle = ''; |
| 54 | 54 |
| 55 if (_height > 0.0) { | 55 if (_height > 0.0) { |
| 56 if (scrollOffset < 0.0) { | 56 if (scrollOffset < 0.0) { |
| 57 double visibleHeight = _height + scrollOffset; | 57 double visibleHeight = _height + scrollOffset; |
| 58 drawCount = (visibleHeight / _itemHeight).round() + 1; | 58 drawCount = (visibleHeight / _itemHeight).round() + 1; |
| 59 transformStyle = | 59 transformStyle = |
| 60 'transform: translateY(${(-scrollOffset).toStringAsFixed(2)}px)'; | 60 'transform: translateY(${(-scrollOffset).toStringAsFixed(2)}px)'; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 78 children: [ | 78 children: [ |
| 79 new Container( | 79 new Container( |
| 80 style: _scrollAreaStyle, | 80 style: _scrollAreaStyle, |
| 81 inlineStyle: transformStyle, | 81 inlineStyle: transformStyle, |
| 82 children: buildItems(itemNumber, drawCount) | 82 children: buildItems(itemNumber, drawCount) |
| 83 ) | 83 ) |
| 84 ] | 84 ] |
| 85 ); | 85 ); |
| 86 } | 86 } |
| 87 } | 87 } |
| OLD | NEW |