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 'dart:math' as math; | 5 import 'dart:math' as math; |
6 | 6 |
7 import 'package:vector_math/vector_math.dart'; | 7 import 'package:vector_math/vector_math.dart'; |
8 | 8 |
9 import '../framework/animation/scroll_behavior.dart'; | 9 import '../framework/animation/scroll_behavior.dart'; |
10 import 'basic.dart'; | 10 import 'basic.dart'; |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 double _height; | 39 double _height; |
40 void _handleSizeChanged(Size newSize) { | 40 void _handleSizeChanged(Size newSize) { |
41 setState(() { | 41 setState(() { |
42 _height = newSize.height; | 42 _height = newSize.height; |
43 scrollBehavior.containerHeight = _height; | 43 scrollBehavior.containerHeight = _height; |
44 }); | 44 }); |
45 } | 45 } |
46 | 46 |
47 UINode buildContent() { | 47 Widget buildContent() { |
48 var itemShowIndex = 0; | 48 var itemShowIndex = 0; |
49 var itemShowCount = 0; | 49 var itemShowCount = 0; |
50 | 50 |
51 Matrix4 transform = new Matrix4.identity(); | 51 Matrix4 transform = new Matrix4.identity(); |
52 | 52 |
53 if (_height != null && _height > 0.0) { | 53 if (_height != null && _height > 0.0) { |
54 if (scrollOffset < 0.0) { | 54 if (scrollOffset < 0.0) { |
55 double visibleHeight = _height + scrollOffset; | 55 double visibleHeight = _height + scrollOffset; |
56 itemShowCount = (visibleHeight / itemHeight).round() + 1; | 56 itemShowCount = (visibleHeight / itemHeight).round() + 1; |
57 transform.translate(0.0, -scrollOffset); | 57 transform.translate(0.0, -scrollOffset); |
(...skipping 14 matching lines...) Expand all Loading... |
72 callback: _handleSizeChanged, | 72 callback: _handleSizeChanged, |
73 child: new ClipRect( | 73 child: new ClipRect( |
74 child: new Transform( | 74 child: new Transform( |
75 transform: transform, | 75 transform: transform, |
76 child: new Block(buildItems(itemShowIndex, itemShowCount)) | 76 child: new Block(buildItems(itemShowIndex, itemShowCount)) |
77 ) | 77 ) |
78 ) | 78 ) |
79 ); | 79 ); |
80 } | 80 } |
81 | 81 |
82 List<UINode> buildItems(int start, int count); | 82 List<Widget> buildItems(int start, int count); |
83 | 83 |
84 } | 84 } |
OLD | NEW |