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

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

Issue 1204523002: Material light and dark themes for Sky widgets (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix analyzer warning properly 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 unified diff | Download patch
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 '../painting/box_painter.dart'; 5 import '../painting/box_painter.dart';
6 import '../theme/colors.dart';
7 import '../theme/edges.dart'; 6 import '../theme/edges.dart';
8 import '../theme/shadows.dart'; 7 import '../theme/shadows.dart';
9 import 'basic.dart'; 8 import 'basic.dart';
9 import 'default_text_style.dart';
10 import 'theme.dart';
10 11
11 class Material extends Component { 12 class Material extends Component {
12 13
13 Material({ 14 Material({
14 String key, 15 String key,
15 this.child, 16 this.child,
16 this.edge: MaterialEdge.card, 17 this.edge: MaterialEdge.card,
17 this.level: 0, 18 this.level: 0,
18 this.color 19 this.color
19 }) : super(key: key); 20 }) : super(key: key);
20 21
21 final Widget child; 22 final Widget child;
22 final int level; 23 final int level;
23 final MaterialEdge edge; 24 final MaterialEdge edge;
24 final Color color; 25 final Color color;
25 26
26 // TODO(ianh): we should make this animate level changes and color changes 27 // TODO(ianh): we should make this animate level changes and color changes
27 28
28 Widget build() { 29 Widget build() {
29 return new Container( 30 return new Container(
30 decoration: new BoxDecoration( 31 decoration: new BoxDecoration(
31 boxShadow: shadows[level], 32 boxShadow: shadows[level],
32 borderRadius: edges[edge], 33 borderRadius: edges[edge],
33 backgroundColor: color == null ? Grey[50] : color, 34 backgroundColor: color == null ? Theme.of(this).backgroundColor : color,
34 shape: edge == MaterialEdge.circle ? Shape.circle : Shape.rectangle 35 shape: edge == MaterialEdge.circle ? Shape.circle : Shape.rectangle
35 ), 36 ),
36 child: child 37 child: new DefaultTextStyle(style: Theme.of(this).text.body1, child: child )
37 ); 38 );
38 } 39 }
39 40
40 } 41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698