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

Side by Side Diff: sky/framework/components/fixed_height_scrollable.dart

Issue 1134163003: [Effen] Use the checkbox widget in the stocks app. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix tests Created 5 years, 7 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
OLDNEW
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 '../debug/tracing.dart'; 6 import '../debug/tracing.dart';
7 import '../fn.dart'; 7 import '../fn.dart';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 import 'dart:async'; 9 import 'dart:async';
10 import 'scrollable.dart'; 10 import 'scrollable.dart';
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (_itemHeight == null) 70 if (_itemHeight == null)
71 new Future.microtask(_measureHeights); 71 new Future.microtask(_measureHeights);
72 72
73 if (_height > 0.0 && _itemHeight != null) { 73 if (_height > 0.0 && _itemHeight != null) {
74 if (scrollOffset < 0.0) { 74 if (scrollOffset < 0.0) {
75 double visibleHeight = _height + scrollOffset; 75 double visibleHeight = _height + scrollOffset;
76 drawCount = (visibleHeight / _itemHeight).round() + 1; 76 drawCount = (visibleHeight / _itemHeight).round() + 1;
77 transformStyle = 77 transformStyle =
78 'transform: translateY(${(-scrollOffset).toStringAsFixed(2)}px)'; 78 'transform: translateY(${(-scrollOffset).toStringAsFixed(2)}px)';
79 } else { 79 } else {
80 drawCount = (_height / _itemHeight).round() + 1; 80 drawCount = (_height / _itemHeight).ceil() + 1;
81 double alignmentDelta = -scrollOffset % _itemHeight; 81 double alignmentDelta = -scrollOffset % _itemHeight;
82 if (alignmentDelta != 0.0) 82 if (alignmentDelta != 0.0)
83 alignmentDelta -= _itemHeight; 83 alignmentDelta -= _itemHeight;
84 84
85 double drawStart = scrollOffset + alignmentDelta; 85 double drawStart = scrollOffset + alignmentDelta;
86 itemNumber = math.max(0, (drawStart / _itemHeight).floor()); 86 itemNumber = math.max(0, (drawStart / _itemHeight).floor());
87 87
88 transformStyle = 88 transformStyle =
89 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)'; 89 'transform: translateY(${(alignmentDelta).toStringAsFixed(2)}px)';
90 } 90 }
91 } 91 }
92 92
93 return new Container( 93 return new Container(
94 style: _style, 94 style: _style,
95 children: [ 95 children: [
96 new Container( 96 new Container(
97 style: _scrollAreaStyle, 97 style: _scrollAreaStyle,
98 inlineStyle: transformStyle, 98 inlineStyle: transformStyle,
99 children: buildItems(itemNumber, drawCount) 99 children: buildItems(itemNumber, drawCount)
100 ) 100 )
101 ] 101 ]
102 ); 102 );
103 } 103 }
104 104
105 List<UINode> buildItems(int start, int count); 105 List<UINode> buildItems(int start, int count);
106 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698