| OLD | NEW |
| 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 'basic.dart'; | 6 import 'basic.dart'; |
| 7 import 'material.dart'; | 7 import 'material.dart'; |
| 8 import "theme.dart"; | 8 import "theme.dart"; |
| 9 | 9 |
| 10 /// A material design card |
| 11 /// |
| 12 /// <https://www.google.com/design/spec/components/cards.html> |
| 10 class Card extends Component { | 13 class Card extends Component { |
| 11 Card({ String key, this.child, this.color }) : super(key: key); | 14 Card({ String key, this.child, this.color }) : super(key: key); |
| 12 | 15 |
| 13 final Widget child; | 16 final Widget child; |
| 14 final Color color; | 17 final Color color; |
| 15 | 18 |
| 16 Widget build() { | 19 Widget build() { |
| 17 return new Container( | 20 return new Container( |
| 18 margin: const EdgeDims.all(4.0), | 21 margin: const EdgeDims.all(4.0), |
| 19 child: new Material( | 22 child: new Material( |
| 20 color: color, | 23 color: color, |
| 21 type: MaterialType.card, | 24 type: MaterialType.card, |
| 22 level: 2, | 25 level: 2, |
| 23 child: new ClipRRect( | 26 child: new ClipRRect( |
| 24 xRadius: edges[MaterialType.card], | 27 xRadius: edges[MaterialType.card], |
| 25 yRadius: edges[MaterialType.card], | 28 yRadius: edges[MaterialType.card], |
| 26 child: child | 29 child: child |
| 27 ) | 30 ) |
| 28 ) | 31 ) |
| 29 ); | 32 ); |
| 30 } | 33 } |
| 31 } | 34 } |
| OLD | NEW |