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

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

Issue 1005633002: Factor ScrollCurve out of Scrollable (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/framework/animation/scroll_curve.dart ('k') | sky/framework/components/scrollable.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 // 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_curve.dart';
5 import '../fn.dart'; 6 import '../fn.dart';
6 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
7 import 'scrollable.dart'; 8 import 'scrollable.dart';
8 9
9 abstract class FixedHeightScrollable extends Scrollable { 10 abstract class FixedHeightScrollable extends Scrollable {
10 // TODO(rafaelw): This component really shouldn't have an opinion 11 // TODO(rafaelw): This component really shouldn't have an opinion
11 // about how it is sized. The owning component should decide whether 12 // about how it is sized. The owning component should decide whether
12 // it's explicitly sized or flexible or whatever... 13 // it's explicitly sized or flexible or whatever...
13 static final Style _style = new Style(''' 14 static final Style _style = new Style('''
14 overflow: hidden; 15 overflow: hidden;
15 position: relative; 16 position: relative;
16 flex: 1; 17 flex: 1;
17 will-change: transform;''' 18 will-change: transform;'''
18 ); 19 );
19 20
20 static final Style _scrollAreaStyle = new Style(''' 21 static final Style _scrollAreaStyle = new Style('''
21 position:relative; 22 position:relative;
22 will-change: transform;''' 23 will-change: transform;'''
23 ); 24 );
24 25
25 double _height = 0.0; 26 double _height = 0.0;
26 double _itemHeight; 27 double _itemHeight;
27 28
28 FixedHeightScrollable({ 29 FixedHeightScrollable({
29 Object key, 30 Object key,
30 double minOffset, 31 ScrollCurve scrollCurve
31 double maxOffset 32 }) : super(key: key, scrollCurve: scrollCurve);
32 }) : super(key: key, minOffset: minOffset, maxOffset: maxOffset) {
33 }
34 33
35 void didMount() { 34 void didMount() {
36 super.didMount(); 35 super.didMount();
37 var root = getRoot(); 36 var root = getRoot();
38 var item = root.firstChild.firstChild; 37 var item = root.firstChild.firstChild;
39 sky.ClientRect scrollRect = root.getBoundingClientRect(); 38 sky.ClientRect scrollRect = root.getBoundingClientRect();
40 sky.ClientRect itemRect = item.getBoundingClientRect(); 39 sky.ClientRect itemRect = item.getBoundingClientRect();
41 assert(scrollRect.height > 0); 40 assert(scrollRect.height > 0);
42 assert(itemRect.height > 0); 41 assert(itemRect.height > 0);
43 42
(...skipping 27 matching lines...) Expand all
71 children: [ 70 children: [
72 new Container( 71 new Container(
73 styles: [_scrollAreaStyle], 72 styles: [_scrollAreaStyle],
74 inlineStyle: transformStyle, 73 inlineStyle: transformStyle,
75 children: buildItems(itemNumber, drawCount) 74 children: buildItems(itemNumber, drawCount)
76 ) 75 )
77 ] 76 ]
78 ); 77 );
79 } 78 }
80 } 79 }
OLDNEW
« no previous file with comments | « sky/framework/animation/scroll_curve.dart ('k') | sky/framework/components/scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698