Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: sky/examples/fn/widgets/fixedheightscrollable.dart

Issue 975863003: Don't hardcode the list of events types in fn (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: More careful event syncing Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/examples/fn/widgets/drawer.dart ('k') | sky/examples/fn/widgets/icon.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of widgets; 1 part of widgets;
2 2
3 abstract class FixedHeightScrollable extends Component { 3 abstract class FixedHeightScrollable extends Component {
4 4
5 static Style _style = new Style(''' 5 static Style _style = new Style('''
6 overflow: hidden; 6 overflow: hidden;
7 position: relative; 7 position: relative;
8 will-change: transform;''' 8 will-change: transform;'''
9 ); 9 );
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 double drawStart = _scrollOffset + alignmentDelta; 43 double drawStart = _scrollOffset + alignmentDelta;
44 int itemNumber = (drawStart / itemHeight).floor(); 44 int itemNumber = (drawStart / itemHeight).floor();
45 45
46 var transformStyle = 46 var transformStyle =
47 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)'; 47 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)';
48 48
49 var items = renderItems(itemNumber, drawCount); 49 var items = renderItems(itemNumber, drawCount);
50 50
51 return new Container( 51 return new Container(
52 style: _style, 52 style: _style,
53 onFlingStart: _handleFlingStart,
54 onFlingCancel: _handleFlingCancel,
55 onScrollUpdate: _handleScrollUpdate,
56 onWheel: _handleWheel,
57 children: [ 53 children: [
58 new Container( 54 new Container(
59 style: _scrollAreaStyle, 55 style: _scrollAreaStyle,
60 inlineStyle: transformStyle, 56 inlineStyle: transformStyle,
61 children: items 57 children: items
62 ) 58 )
63 ] 59 ]
64 ); 60 )
61 ..events.listen('gestureflingstart', _handleFlingStart)
62 ..events.listen('gestureflingcancel', _handleFlingCancel)
63 ..events.listen('gesturescrollupdate', _handleScrollUpdate)
64 ..events.listen('wheel', _handleWheel);
65 } 65 }
66 66
67 void willUnmount() { 67 void willUnmount() {
68 _stopFling(); 68 _stopFling();
69 } 69 }
70 70
71 bool _scrollBy(double scrollDelta) { 71 bool _scrollBy(double scrollDelta) {
72 var newScrollOffset = _scrollOffset + scrollDelta; 72 var newScrollOffset = _scrollOffset + scrollDelta;
73 if (minOffset != null && newScrollOffset < minOffset) { 73 if (minOffset != null && newScrollOffset < minOffset) {
74 newScrollOffset = minOffset; 74 newScrollOffset = minOffset;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 void _handleFlingCancel(sky.Event event) { 120 void _handleFlingCancel(sky.Event event) {
121 _stopFling(); 121 _stopFling();
122 } 122 }
123 123
124 void _handleWheel(sky.Event event) { 124 void _handleWheel(sky.Event event) {
125 _scrollBy(-event.offsetY); 125 _scrollBy(-event.offsetY);
126 } 126 }
127 } 127 }
OLDNEW
« no previous file with comments | « sky/examples/fn/widgets/drawer.dart ('k') | sky/examples/fn/widgets/icon.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698