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 'button_base.dart'; | 6 import 'button_base.dart'; |
7 import 'ink_well.dart'; | 7 import 'ink_well.dart'; |
8 import 'material.dart'; | 8 import 'material.dart'; |
9 | 9 |
10 typedef void ValueChanged(value); | 10 typedef void ValueChanged(value); |
11 | 11 |
12 class Radio extends ButtonBase { | 12 class Radio extends ButtonBase { |
13 Object value; | 13 Object value; |
14 Object groupValue; | 14 Object groupValue; |
15 ValueChanged onChanged; | 15 ValueChanged onChanged; |
16 | 16 |
17 static final Style _style = new Style(''' | 17 static final Style _style = new Style(''' |
18 transform: translateX(0); | 18 transform: translateX(0); |
19 display: inline-block; | 19 display: inline-flex; |
20 -webkit-user-select: none; | 20 -webkit-user-select: none; |
21 width: 14px; | 21 width: 14px; |
22 height: 14px; | 22 height: 14px; |
23 border-radius: 7px; | 23 border-radius: 7px; |
24 border: 1px solid blue; | 24 border: 1px solid blue; |
25 margin: 0 5px;''' | 25 margin: 0 5px;''' |
26 ); | 26 ); |
27 | 27 |
28 static final Style _highlightStyle = new Style(''' | 28 static final Style _highlightStyle = new Style(''' |
29 transform: translateX(0); | 29 transform: translateX(0); |
30 display: inline-block; | 30 display: inline-flex; |
31 -webkit-user-select: none; | 31 -webkit-user-select: none; |
32 width: 14px; | 32 width: 14px; |
33 height: 14px; | 33 height: 14px; |
34 border-radius: 7px; | 34 border-radius: 7px; |
35 border: 1px solid blue; | 35 border: 1px solid blue; |
36 margin: 0 5px; | 36 margin: 0 5px; |
37 background-color: orange;''' | 37 background-color: orange;''' |
38 ); | 38 ); |
39 | 39 |
40 static final Style _dotStyle = new Style(''' | 40 static final Style _dotStyle = new Style(''' |
(...skipping 21 matching lines...) Expand all Loading... |
62 highlight ? _highlightStyle : _style | 62 highlight ? _highlightStyle : _style |
63 ), | 63 ), |
64 onGestureTap: _handleClick | 64 onGestureTap: _handleClick |
65 ); | 65 ); |
66 } | 66 } |
67 | 67 |
68 void _handleClick(_) { | 68 void _handleClick(_) { |
69 onChanged(value); | 69 onChanged(value); |
70 } | 70 } |
71 } | 71 } |
OLD | NEW |