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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (alignmentDelta != 0.0) | 61 if (alignmentDelta != 0.0) |
62 alignmentDelta -= itemHeight; | 62 alignmentDelta -= itemHeight; |
63 | 63 |
64 double drawStart = scrollOffset + alignmentDelta; | 64 double drawStart = scrollOffset + alignmentDelta; |
65 itemShowIndex = math.max(0, (drawStart / itemHeight).floor()); | 65 itemShowIndex = math.max(0, (drawStart / itemHeight).floor()); |
66 | 66 |
67 transform.translate(0.0, alignmentDelta); | 67 transform.translate(0.0, alignmentDelta); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
| 71 List<Widget> items = buildItems(itemShowIndex, itemShowCount); |
| 72 assert(items.every((item) => item.key != null)); |
| 73 |
71 return new SizeObserver( | 74 return new SizeObserver( |
72 callback: _handleSizeChanged, | 75 callback: _handleSizeChanged, |
73 child: new ClipRect( | 76 child: new ClipRect( |
74 child: new Transform( | 77 child: new Transform( |
75 transform: transform, | 78 transform: transform, |
76 child: new Block(buildItems(itemShowIndex, itemShowCount)) | 79 child: new Block(items) |
77 ) | 80 ) |
78 ) | 81 ) |
79 ); | 82 ); |
80 } | 83 } |
81 | 84 |
82 List<Widget> buildItems(int start, int count); | 85 List<Widget> buildItems(int start, int count); |
83 | 86 |
84 } | 87 } |
OLD | NEW |