| 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 '../animation/scroll_behavior.dart'; | 5 import '../animation/scroll_behavior.dart'; |
| 6 import '../fn.dart'; | 6 import '../fn.dart'; |
| 7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
| 9 import 'scrollable.dart'; | 9 import 'scrollable.dart'; |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 position:relative; | 23 position:relative; |
| 24 will-change: transform;''' | 24 will-change: transform;''' |
| 25 ); | 25 ); |
| 26 | 26 |
| 27 double _height = 0.0; | 27 double _height = 0.0; |
| 28 double _itemHeight; | 28 double _itemHeight; |
| 29 | 29 |
| 30 FixedHeightScrollable({ | 30 FixedHeightScrollable({ |
| 31 Object key, | 31 Object key, |
| 32 ScrollBehavior scrollBehavior | 32 ScrollBehavior scrollBehavior |
| 33 }) : super(key: key, scrollBehavior: scrollBehavior); | 33 }) : super(key: key, scrollBehavior: scrollBehavior) { |
| 34 onDidMount(_measureHeights); |
| 35 } |
| 34 | 36 |
| 35 void didMount() { | 37 void _measureHeights() { |
| 36 super.didMount(); | |
| 37 var root = getRoot(); | 38 var root = getRoot(); |
| 38 var item = root.firstChild.firstChild; | 39 var item = root.firstChild.firstChild; |
| 39 sky.ClientRect scrollRect = root.getBoundingClientRect(); | 40 sky.ClientRect scrollRect = root.getBoundingClientRect(); |
| 40 sky.ClientRect itemRect = item.getBoundingClientRect(); | 41 sky.ClientRect itemRect = item.getBoundingClientRect(); |
| 41 assert(scrollRect.height > 0); | 42 assert(scrollRect.height > 0); |
| 42 assert(itemRect.height > 0); | 43 assert(itemRect.height > 0); |
| 43 | 44 |
| 44 setState(() { | 45 setState(() { |
| 45 _height = scrollRect.height; | 46 _height = scrollRect.height; |
| 46 _itemHeight = itemRect.height; | 47 _itemHeight = itemRect.height; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 children: [ | 79 children: [ |
| 79 new Container( | 80 new Container( |
| 80 style: _scrollAreaStyle, | 81 style: _scrollAreaStyle, |
| 81 inlineStyle: transformStyle, | 82 inlineStyle: transformStyle, |
| 82 children: buildItems(itemNumber, drawCount) | 83 children: buildItems(itemNumber, drawCount) |
| 83 ) | 84 ) |
| 84 ] | 85 ] |
| 85 ); | 86 ); |
| 86 } | 87 } |
| 87 } | 88 } |
| OLD | NEW |