| 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/fling-curve.dart'; | 5 import '../animation/fling-curve.dart'; |
| 6 import '../fn.dart'; | 6 import '../fn.dart'; |
| 7 import 'dart:sky' as sky; | 7 import 'dart:sky' as sky; |
| 8 | 8 |
| 9 abstract class FixedHeightScrollable extends Component { | 9 abstract class FixedHeightScrollable extends Component { |
| 10 // TODO(rafaelw): This component really shouldn't have an opinion | 10 // TODO(rafaelw): This component really shouldn't have an opinion |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 double drawStart = _scrollOffset + alignmentDelta; | 73 double drawStart = _scrollOffset + alignmentDelta; |
| 74 itemNumber = (drawStart / _itemHeight).floor(); | 74 itemNumber = (drawStart / _itemHeight).floor(); |
| 75 | 75 |
| 76 transformStyle = | 76 transformStyle = |
| 77 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)'; | 77 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)'; |
| 78 } | 78 } |
| 79 | 79 |
| 80 return new Container( | 80 return new Container( |
| 81 style: _style, | 81 styles: [_style], |
| 82 children: [ | 82 children: [ |
| 83 new Container( | 83 new Container( |
| 84 style: _scrollAreaStyle, | 84 styles: [_scrollAreaStyle], |
| 85 inlineStyle: transformStyle, | 85 inlineStyle: transformStyle, |
| 86 children: buildItems(itemNumber, drawCount) | 86 children: buildItems(itemNumber, drawCount) |
| 87 ) | 87 ) |
| 88 ] | 88 ] |
| 89 ); | 89 ); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void didUnmount() { | 92 void didUnmount() { |
| 93 _stopFling(); | 93 _stopFling(); |
| 94 } | 94 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 void _handleFlingCancel(sky.GestureEvent event) { | 145 void _handleFlingCancel(sky.GestureEvent event) { |
| 146 _stopFling(); | 146 _stopFling(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void _handleWheel(sky.WheelEvent event) { | 149 void _handleWheel(sky.WheelEvent event) { |
| 150 _scrollBy(-event.offsetY); | 150 _scrollBy(-event.offsetY); |
| 151 } | 151 } |
| 152 } | 152 } |
| OLD | NEW |