| 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 '../base/lerp.dart'; | 5 import '../base/lerp.dart'; |
| 6 import '../animation/animated_value.dart'; | 6 import '../animation/animated_value.dart'; |
| 7 import '../painting/box_painter.dart'; | 7 import '../painting/box_painter.dart'; |
| 8 import '../theme/edges.dart'; | 8 import '../theme/edges.dart'; |
| 9 import '../theme/shadows.dart'; | 9 import '../theme/shadows.dart'; |
| 10 import 'animated_component.dart'; | 10 import 'animated_component.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 class Material extends AnimatedComponent { | 33 class Material extends AnimatedComponent { |
| 34 | 34 |
| 35 Material({ | 35 Material({ |
| 36 String key, | 36 String key, |
| 37 this.child, | 37 this.child, |
| 38 this.edge: MaterialEdge.card, | 38 this.edge: MaterialEdge.card, |
| 39 int level: 0, | 39 int level: 0, |
| 40 this.color | 40 this.color |
| 41 }) : super(key: key) { | 41 }) : super(key: key) { |
| 42 this.level = new AnimatedValue(level.toDouble()); | 42 this.level = new AnimatedValue(level == null ? 0.0 : level.toDouble()); |
| 43 watch(this.level); | 43 watch(this.level); |
| 44 } | 44 } |
| 45 | 45 |
| 46 Widget child; | 46 Widget child; |
| 47 MaterialEdge edge; | 47 MaterialEdge edge; |
| 48 AnimatedValue level; | 48 AnimatedValue level; |
| 49 Color color; | 49 Color color; |
| 50 | 50 |
| 51 void syncFields(Material source) { | 51 void syncFields(Material source) { |
| 52 child = source.child; | 52 child = source.child; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 boxShadow: _computeShadow(level.value), | 67 boxShadow: _computeShadow(level.value), |
| 68 borderRadius: edges[edge], | 68 borderRadius: edges[edge], |
| 69 backgroundColor: color, | 69 backgroundColor: color, |
| 70 shape: edge == MaterialEdge.circle ? Shape.circle : Shape.rectangle | 70 shape: edge == MaterialEdge.circle ? Shape.circle : Shape.rectangle |
| 71 ), | 71 ), |
| 72 child: new DefaultTextStyle(style: Theme.of(this).text.body1, child: child
) | 72 child: new DefaultTextStyle(style: Theme.of(this).text.body1, child: child
) |
| 73 ); | 73 ); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } | 76 } |
| OLD | NEW |