Chromium Code Reviews| Index: sky/sdk/lib/widgets/material.dart |
| diff --git a/sky/sdk/lib/widgets/material.dart b/sky/sdk/lib/widgets/material.dart |
| index cc7ebffb9afd690cd593a79cbb691f3b53a90616..107193b4ebea716719a6b1ee07adf09d34bc2df8 100644 |
| --- a/sky/sdk/lib/widgets/material.dart |
| +++ b/sky/sdk/lib/widgets/material.dart |
| @@ -39,18 +39,22 @@ class Material extends AnimatedComponent { |
| int level; |
| Color color; |
| - AnimationBuilder _builder; |
| + final AnimationBuilder _builder = new AnimationBuilder(); |
|
Matt Perry
2015/07/13 17:32:55
Wouldn't this cause us to allocate a new object fo
abarth-chromium
2015/07/13 17:41:06
Constructors for final fields are called lazily th
abarth-chromium
2015/07/13 17:44:59
s/Constructors/initializers/
|
| void initState() { |
| - _builder = new AnimationBuilder() |
| + _builder |
| ..shadow = new AnimatedType<double>(level.toDouble()) |
| ..backgroundColor = _getBackgroundColor(type, color) |
| ..borderRadius = edges[type] |
| ..shape = type == MaterialType.circle ? Shape.circle : Shape.rectangle; |
| watchPerformance(_builder.createPerformance( |
| - [_builder.shadow], duration: _kAnimateShadowDuration)); |
| + [_builder.shadow], |
| + duration: _kAnimateShadowDuration |
| + )); |
| watchPerformance(_builder.createPerformance( |
| - [_builder.backgroundColor], duration: _kAnimateColorDuration)); |
| + [_builder.backgroundColor], |
| + duration: _kAnimateColorDuration |
| + )); |
| super.initState(); |
| } |