OLD | NEW |
(Empty) | |
| 1 part of animation; |
| 2 |
| 3 @Component( |
| 4 selector: 'stress-demo', |
| 5 template: ''' |
| 6 <div class="stress-demo"> |
| 7 <button ng-click="ctrl.visible = !ctrl.visible"> |
| 8 Toggle Visibility</button> |
| 9 <div> |
| 10 <div class="stress-box" ng-repeat="number in ctrl.numbers"></div> |
| 11 </div> |
| 12 </div> |
| 13 ''', |
| 14 publishAs: 'ctrl', |
| 15 applyAuthorStyles: true) |
| 16 class StressDemo { |
| 17 bool _visible = true; |
| 18 final numbers = <int>[1, 2]; |
| 19 |
| 20 // When visibility changes add or remove a large chunk of elements. |
| 21 void set visible(bool value) { |
| 22 if (value) { |
| 23 for (int i = 0; i < 200; i++) { |
| 24 numbers.add(i); |
| 25 } |
| 26 } else { |
| 27 numbers.clear(); |
| 28 } |
| 29 _visible = value; |
| 30 } |
| 31 |
| 32 bool get visible => _visible; |
| 33 } |
OLD | NEW |