Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Unified Diff: sky/sdk/lib/widgets/card.dart

Issue 1217623002: Support for background images on cards, style demo home (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove unused file Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/widgets/card.dart
diff --git a/sky/sdk/lib/widgets/card.dart b/sky/sdk/lib/widgets/card.dart
new file mode 100644
index 0000000000000000000000000000000000000000..93f67d7bb4e97ce8d48993c388ce8524df1ec2b3
--- /dev/null
+++ b/sky/sdk/lib/widgets/card.dart
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import '../theme/colors.dart' as colors;
+import '../theme/edges.dart';
+import 'basic.dart';
+import 'material.dart';
+import "theme.dart";
+
+class Card extends Component {
+ Card({ String key, this.child, this.color }) : super(key: key);
+
+ final Widget child;
+ final Color color;
+
+ Color get materialColor {
+ if (color != null)
+ return color;
+ switch (Theme.of(this).brightness) {
+ case ThemeBrightness.light:
+ return colors.White;
+ case ThemeBrightness.dark:
+ return colors.Grey[800];
+ }
+ }
+
+ Widget build() {
+ return new Container(
+ margin: const EdgeDims(8.0, 8.0, 0.0, 8.0),
+ child: new Material(
+ color: materialColor,
+ edge: MaterialEdge.card,
+ level: 2,
+ child: new ClipRRect(
+ xRadius: edges[MaterialEdge.card],
+ yRadius: edges[MaterialEdge.card],
+ child: child
+ )
+ )
+ );
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698