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

Side by Side Diff: sky/sdk/lib/widgets/card.dart

Issue 1218153005: Refactoring to support dark theme better (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix import issues 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/theme/theme_data.dart ('k') | sky/sdk/lib/widgets/checkbox.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import '../theme/colors.dart' as colors; 5 import '../theme/colors.dart' as colors;
6 import '../theme/edges.dart';
7 import 'basic.dart'; 6 import 'basic.dart';
8 import 'material.dart'; 7 import 'material.dart';
9 import "theme.dart"; 8 import "theme.dart";
10 9
11 class Card extends Component { 10 class Card extends Component {
12 Card({ String key, this.child, this.color }) : super(key: key); 11 Card({ String key, this.child, this.color }) : super(key: key);
13 12
14 final Widget child; 13 final Widget child;
15 final Color color; 14 final Color color;
16 15
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() { 16 Widget build() {
29 return new Container( 17 return new Container(
30 margin: const EdgeDims.all(4.0), 18 margin: const EdgeDims.all(4.0),
31 child: new Material( 19 child: new Material(
32 color: materialColor, 20 color: color,
33 edge: MaterialEdge.card, 21 type: MaterialType.card,
34 level: 2, 22 level: 2,
35 child: new ClipRRect( 23 child: new ClipRRect(
36 xRadius: edges[MaterialEdge.card], 24 xRadius: edges[MaterialType.card],
37 yRadius: edges[MaterialEdge.card], 25 yRadius: edges[MaterialType.card],
38 child: child 26 child: child
39 ) 27 )
40 ) 28 )
41 ); 29 );
42 } 30 }
43 } 31 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/theme/theme_data.dart ('k') | sky/sdk/lib/widgets/checkbox.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698