OLD | NEW |
1 part of widgets; | 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 import '../fn.dart'; |
| 6 import 'button_base.dart'; |
2 | 7 |
3 class Button extends ButtonBase { | 8 class Button extends ButtonBase { |
4 | 9 static final Style _style = new Style(''' |
5 static Style _style = new Style(''' | |
6 transform: translateX(0); | 10 transform: translateX(0); |
7 display: inline-flex; | 11 display: inline-flex; |
8 border-radius: 4px; | 12 border-radius: 4px; |
9 justify-content: center; | 13 justify-content: center; |
10 align-items: center; | 14 align-items: center; |
11 border: 1px solid blue; | 15 border: 1px solid blue; |
12 -webkit-user-select: none; | 16 -webkit-user-select: none; |
13 margin: 5px;''' | 17 margin: 5px;''' |
14 ); | 18 ); |
15 | 19 |
16 static Style _highlightStyle = new Style(''' | 20 static final Style _highlightStyle = new Style(''' |
17 transform: translateX(0); | 21 transform: translateX(0); |
18 display: inline-flex; | 22 display: inline-flex; |
19 border-radius: 4px; | 23 border-radius: 4px; |
20 justify-content: center; | 24 justify-content: center; |
21 align-items: center; | 25 align-items: center; |
22 border: 1px solid blue; | 26 border: 1px solid blue; |
23 -webkit-user-select: none; | 27 -webkit-user-select: none; |
24 margin: 5px; | 28 margin: 5px; |
25 background-color: orange;''' | 29 background-color: orange;''' |
26 ); | 30 ); |
27 | 31 |
28 Node content; | 32 Node content; |
29 | 33 |
30 Button({ Object key, this.content }) : super(key: key); | 34 Button({ Object key, this.content }) : super(key: key); |
31 | 35 |
32 Node build() { | 36 Node build() { |
33 return new Container( | 37 return new Container( |
34 key: 'Button', | 38 style: highlight ? _highlightStyle : _style, |
35 style: _highlight ? _highlightStyle : _style, | |
36 children: [super.build(), content] | 39 children: [super.build(), content] |
37 ); | 40 ); |
38 } | 41 } |
39 } | 42 } |
OLD | NEW |