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