Index: sky/sdk/lib/widgets/material.dart |
diff --git a/sky/sdk/lib/widgets/material.dart b/sky/sdk/lib/widgets/material.dart |
index e56c59735a8220b0a717de08071e83717f586374..dab12135fd89ca5175502f44c6ba566a4c920ea2 100644 |
--- a/sky/sdk/lib/widgets/material.dart |
+++ b/sky/sdk/lib/widgets/material.dart |
@@ -29,14 +29,16 @@ class Material extends AnimatedComponent { |
Material({ |
String key, |
this.child, |
- this.type: MaterialType.card, |
+ MaterialType type: MaterialType.card, |
int level: 0, |
Color color: null |
}) : super(key: key) { |
if (level == null) level = 0; |
_container = new AnimatedContainer() |
..shadow = new AnimatedType<double>(level.toDouble()) |
- ..backgroundColor = new AnimatedColor(_getBackgroundColor(color)); |
+ ..backgroundColor = new AnimatedColor(_getBackgroundColor(type, color)) |
Matt Perry
2015/07/09 19:17:21
One thing I'm worried about here: do we create a n
abarth-chromium
2015/07/09 19:19:00
We create a new widget.
|
+ ..borderRadius = edges[type] |
+ ..shape = type == MaterialType.circle ? Shape.circle : Shape.rectangle; |
watch(_container.createPerformance( |
_container.shadow, duration: _kAnimateShadowDuration).timeline); |
watch(_container.createPerformance( |
@@ -44,21 +46,19 @@ class Material extends AnimatedComponent { |
} |
Widget child; |
- MaterialType type; |
AnimatedContainer _container; |
void syncFields(Material source) { |
child = source.child; |
- type = source.type; |
_container.syncFields(source._container); |
super.syncFields(source); |
} |
- Color _getBackgroundColor(Color color) { |
+ Color _getBackgroundColor(MaterialType type, Color color) { |
if (color != null) |
return color; |
- switch(type) { |
+ switch (type) { |
case MaterialType.canvas: |
return Theme.of(this).canvasColor; |
case MaterialType.card: |
@@ -70,15 +70,8 @@ class Material extends AnimatedComponent { |
Widget build() { |
return _container.build( |
- new Container( |
- // TODO(mpcomplete): move the rest of this decoration into |
- // AnimatedContainer as non-animated values. |
- decoration: new BoxDecoration( |
- borderRadius: edges[type], |
- shape: type == MaterialType.circle ? Shape.circle : Shape.rectangle |
- ), |
- child: new DefaultTextStyle(style: Theme.of(this).text.body1, child: child) |
- )); |
+ new DefaultTextStyle(style: Theme.of(this).text.body1, child: child) |
+ ); |
} |
} |