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 '../fn.dart'; | 5 import '../fn.dart'; |
6 import 'material.dart'; | 6 import 'material.dart'; |
7 import '../theme/colors.dart'; | 7 import '../theme/colors.dart'; |
8 | 8 |
9 class FloatingActionButton extends Component { | 9 class FloatingActionButton extends Component { |
10 static final Style _style = new Style(''' | 10 static final Style _style = new Style(''' |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 FloatingActionButton({ Object key, this.content, this.level: 0 }) | 37 FloatingActionButton({ Object key, this.content, this.level: 0 }) |
38 : super(key: key); | 38 : super(key: key); |
39 | 39 |
40 Node build() { | 40 Node build() { |
41 List<Node> children = []; | 41 List<Node> children = []; |
42 | 42 |
43 if (content != null) | 43 if (content != null) |
44 children.add(content); | 44 children.add(content); |
45 | 45 |
46 List<Style> containerStyle = [_style]; | |
47 if (level > 0) | |
48 containerStyle.add(Material.shadowStyle[level]); | |
49 | |
50 return new Container( | 46 return new Container( |
51 key: "Container", | 47 key: "Container", |
52 styles: containerStyle, | 48 style: level > 0 ? _style.extend(Material.shadowStyle[level]) : _style, |
53 children: [ | 49 children: [ |
54 new Material( | 50 new Material( |
55 key: "Clip", | 51 key: "Clip", |
56 styles: [_clipStyle], | 52 style: _clipStyle, |
57 children: children | 53 children: children |
58 ) | 54 ) |
59 ] | 55 ] |
60 ); | 56 ); |
61 } | 57 } |
62 } | 58 } |
OLD | NEW |