OLD | NEW |
1 part of widgets; | 1 part of widgets; |
2 | 2 |
3 class Radio extends ButtonBase { | 3 class Radio extends ButtonBase { |
4 | 4 |
5 Object value; | 5 Object value; |
6 Object groupValue; | 6 Object groupValue; |
7 ValueChanged onChanged; | 7 ValueChanged onChanged; |
8 | 8 |
9 static Style _style = new Style(''' | 9 static Style _style = new Style(''' |
| 10 transform: translateX(0); |
10 display: inline-block; | 11 display: inline-block; |
11 -webkit-user-select: none; | 12 -webkit-user-select: none; |
12 width: 14px; | 13 width: 14px; |
13 height: 14px; | 14 height: 14px; |
14 border-radius: 7px; | 15 border-radius: 7px; |
15 border: 1px solid blue; | 16 border: 1px solid blue; |
16 margin: 0 5px;''' | 17 margin: 0 5px;''' |
17 ); | 18 ); |
18 | 19 |
19 static Style _highlightStyle = new Style(''' | 20 static Style _highlightStyle = new Style(''' |
| 21 transform: translateX(0); |
20 display: inline-block; | 22 display: inline-block; |
21 -webkit-user-select: none; | 23 -webkit-user-select: none; |
22 width: 14px; | 24 width: 14px; |
23 height: 14px; | 25 height: 14px; |
24 border-radius: 7px; | 26 border-radius: 7px; |
25 border: 1px solid blue; | 27 border: 1px solid blue; |
26 margin: 0 5px; | 28 margin: 0 5px; |
27 background-color: orange;''' | 29 background-color: orange;''' |
28 ); | 30 ); |
29 | 31 |
(...skipping 14 matching lines...) Expand all Loading... |
44 }) : super(key: key); | 46 }) : super(key: key); |
45 | 47 |
46 Node render() { | 48 Node render() { |
47 return new Container( | 49 return new Container( |
48 style: _highlight ? _highlightStyle : _style, | 50 style: _highlight ? _highlightStyle : _style, |
49 onClick: _handleClick, | 51 onClick: _handleClick, |
50 onPointerDown: _handlePointerDown, | 52 onPointerDown: _handlePointerDown, |
51 onPointerUp: _handlePointerUp, | 53 onPointerUp: _handlePointerUp, |
52 onPointerCancel: _handlePointerCancel, | 54 onPointerCancel: _handlePointerCancel, |
53 children: value == groupValue ? | 55 children: value == groupValue ? |
54 [new Container( style : _dotStyle )] : null | 56 [super.render(), new Container( style : _dotStyle )] : [super.render()
] |
55 ); | 57 ); |
56 } | 58 } |
57 | 59 |
58 void _handleClick(sky.Event e) { | 60 void _handleClick(sky.Event e) { |
59 onChanged(value); | 61 onChanged(value); |
60 } | 62 } |
61 } | 63 } |
OLD | NEW |