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 import '../theme/shadows.dart'; | 8 import '../theme/shadows.dart'; |
9 | 9 |
10 class FloatingActionButton extends Material { | 10 class FloatingActionButton extends Component { |
11 static final Style _style = new Style(''' | 11 static final Style _style = new Style(''' |
12 position: absolute; | 12 position: absolute; |
13 bottom: 16px; | 13 bottom: 16px; |
14 right: 16px; | 14 right: 16px; |
15 z-index: 5; | 15 z-index: 5; |
16 transform: translateX(0); | 16 transform: translateX(0); |
17 width: 56px; | 17 width: 56px; |
18 height: 56px; | 18 height: 56px; |
19 background-color: ${Red[500]}; | 19 background-color: ${Red[500]}; |
20 color: white; | 20 color: white; |
(...skipping 10 matching lines...) Expand all Loading... |
31 left: 0; | 31 left: 0; |
32 right: 0; | 32 right: 0; |
33 bottom: 0; | 33 bottom: 0; |
34 -webkit-clip-path: circle(28px at center);'''); | 34 -webkit-clip-path: circle(28px at center);'''); |
35 | 35 |
36 Node content; | 36 Node content; |
37 | 37 |
38 FloatingActionButton({ Object key, this.content }) : super(key: key); | 38 FloatingActionButton({ Object key, this.content }) : super(key: key); |
39 | 39 |
40 Node build() { | 40 Node build() { |
41 List<Node> children = [super.build()]; | 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 return new Container( | 46 return new Container( |
47 key: "Container", | 47 key: "Container", |
48 style: _style, | 48 style: _style, |
49 children: [ | 49 children: [ |
50 new Container( | 50 new Material( |
51 key: "Clip", | 51 key: "Clip", |
52 style: _clipStyle, | 52 style: _clipStyle, |
53 children: children | 53 children: children |
54 ) | 54 ) |
55 ] | 55 ] |
56 ); | 56 ); |
57 } | 57 } |
58 } | 58 } |
OLD | NEW |