Index: sky/sdk/lib/framework/widgets/material.dart |
diff --git a/sky/sdk/lib/framework/widgets/material.dart b/sky/sdk/lib/framework/widgets/material.dart |
index 89f3a56a198dcc2ed058a26b6bd5bd8a7bb7d021..3f53c1b452a308ae5931894babe8aa2ed8d2d25f 100644 |
--- a/sky/sdk/lib/framework/widgets/material.dart |
+++ b/sky/sdk/lib/framework/widgets/material.dart |
@@ -2,28 +2,39 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+import '../painting/box_painter.dart'; |
+import '../theme2/colors.dart'; |
+import '../theme2/edges.dart'; |
+import '../theme2/shadows.dart'; |
import 'wrappers.dart'; |
class Material extends Component { |
- Material({ Object key, this.content, this.level: 0 }) : super(key: key); |
+ Material({ |
+ Object key, |
+ this.child, |
+ this.edge: MaterialEdge.card, |
+ this.level: 0, |
+ this.color |
+ }) : super(key: key); |
- // static final List<Style> _shadowStyle = [ |
- // null, |
- // new Style('box-shadow: ${Shadow[1]}'), |
- // new Style('box-shadow: ${Shadow[2]}'), |
- // new Style('box-shadow: ${Shadow[3]}'), |
- // new Style('box-shadow: ${Shadow[4]}'), |
- // new Style('box-shadow: ${Shadow[5]}'), |
- // ]; |
- |
- final UINode content; |
+ final UINode child; |
final int level; |
+ final MaterialEdge edge; |
+ final Color color; |
+ |
+ // TODO(ianh): we should make this animate level changes and color changes |
UINode build() { |
- // TODO(eseidel): Add a shadow. |
- // return new StyleNode(content, _shadowStyle[level]); |
- return content; |
+ return new Container( |
+ decoration: new BoxDecoration( |
+ boxShadow: shadows[level], |
+ borderRadius: edges[edge], |
+ backgroundColor: color == null ? Grey[50] : color, |
+ shape: edge == MaterialEdge.circle ? Shape.circle : Shape.rectangle |
+ ), |
+ child: child |
+ ); |
} |
} |