| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 @HtmlImport('x_list.html') | 4 @HtmlImport('x_list.html') |
| 5 library polymer_elements.test.fixtures.x_list; | 5 library polymer_elements.test.fixtures.x_list; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'package:polymer_elements/iron_flex_layout.dart'; | 8 import 'package:polymer_elements/iron_flex_layout.dart'; |
| 9 import 'package:polymer_elements/iron_list.dart'; | 9 import 'package:polymer_elements/iron_list.dart'; |
| 10 import 'package:web_components/web_components.dart'; | 10 import 'package:web_components/web_components.dart'; |
| 11 | 11 |
| 12 /// Uses [IronFlexLayout] and [IronList] | 12 /// Uses [IronFlexLayout] and [IronList] |
| 13 @PolymerRegister('x-list') | 13 @PolymerRegister('x-list') |
| 14 class XList extends PolymerElement { | 14 class XList extends PolymerElement { |
| 15 XList.created() : super.created(); | 15 XList.created() : super.created(); |
| 16 | 16 |
| 17 @property | 17 @property |
| 18 List data; | 18 List data; |
| 19 | 19 |
| 20 @property | 20 @property |
| 21 int itemHeight = 100; | 21 int itemHeight = 100; |
| 22 | 22 |
| 23 @property | 23 @property |
| 24 int listHeight = 300; | 24 int listHeight = 300; |
| 25 |
| 26 @property |
| 27 bool pre = false; |
| 25 | 28 |
| 26 get list => $['list']; | 29 get list => $['list']; |
| 27 | 30 |
| 28 @reflectable | 31 @reflectable |
| 29 String computedItemHeight() => 'height: ${itemHeight}px'; | 32 String computedItemHeight(item) { |
| 33 var css = pre ? 'white-space:pre;' : ''; |
| 34 if (item['height'] != null && item['height'] != 0) { |
| 35 css += itemHeight == 0 ? '' : 'height: ${item['height']}px;'; |
| 36 } else if (itemHeight != 0) { |
| 37 css += 'height: ${itemHeight}px;'; |
| 38 } |
| 39 return css; |
| 40 } |
| 30 | 41 |
| 31 @reflectable | 42 @reflectable |
| 32 String computedListHeight(listHeight) => 'height: ${listHeight}px'; | 43 String computedListHeight(listHeight) => 'height: ${listHeight}px'; |
| 33 } | 44 } |
| OLD | NEW |