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

Side by Side 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: rebase Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | sky/sdk/lib/widgets/floating_action_button.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 import '../theme/colors.dart' as colors;
6 import '../theme/edges.dart';
7 import 'basic.dart';
8 import 'material.dart';
9 import "theme.dart";
10
11 class Card extends Component {
12 Card({ String key, this.child, this.color }) : super(key: key);
13
14 final Widget child;
15 final Color color;
16
17 Color get materialColor {
18 if (color != null)
19 return color;
20 switch (Theme.of(this).brightness) {
21 case ThemeBrightness.light:
22 return colors.White;
23 case ThemeBrightness.dark:
24 return colors.Grey[800];
25 }
26 }
27
28 Widget build() {
29 return new Container(
30 margin: const EdgeDims(8.0, 8.0, 0.0, 8.0),
31 child: new Material(
32 color: materialColor,
33 edge: MaterialEdge.card,
34 level: 2,
35 child: new ClipRRect(
36 xRadius: edges[MaterialEdge.card],
37 yRadius: edges[MaterialEdge.card],
38 child: child
39 )
40 )
41 );
42 }
43 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | sky/sdk/lib/widgets/floating_action_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698