| 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'; | |
| 9 | 8 |
| 10 typedef void ValueChanged(value); | 9 typedef void ValueChanged(value); |
| 11 | 10 |
| 12 class Radio extends ButtonBase { | 11 class Radio extends ButtonBase { |
| 13 Object value; | 12 Object value; |
| 14 Object groupValue; | 13 Object groupValue; |
| 15 ValueChanged onChanged; | 14 ValueChanged onChanged; |
| 16 | 15 |
| 17 static final Style _style = new Style(''' | 16 static final Style _style = new Style(''' |
| 18 transform: translateX(0); | |
| 19 display: inline-flex; | |
| 20 -webkit-user-select: none; | |
| 21 width: 14px; | 17 width: 14px; |
| 22 height: 14px; | 18 height: 14px; |
| 23 border-radius: 7px; | 19 border-radius: 7px; |
| 24 border: 1px solid blue; | 20 border: 1px solid blue; |
| 25 margin: 0 5px;''' | 21 margin: 0 5px;''' |
| 26 ); | 22 ); |
| 27 | 23 |
| 28 static final Style _highlightStyle = new Style(''' | 24 static final Style _highlightStyle = new Style(''' |
| 29 transform: translateX(0); | |
| 30 display: inline-flex; | |
| 31 -webkit-user-select: none; | |
| 32 width: 14px; | 25 width: 14px; |
| 33 height: 14px; | 26 height: 14px; |
| 34 border-radius: 7px; | 27 border-radius: 7px; |
| 35 border: 1px solid blue; | 28 border: 1px solid blue; |
| 36 margin: 0 5px; | 29 margin: 0 5px; |
| 37 background-color: orange;''' | 30 background-color: orange;''' |
| 38 ); | 31 ); |
| 39 | 32 |
| 40 static final Style _dotStyle = new Style(''' | 33 static final Style _dotStyle = new Style(''' |
| 41 -webkit-user-select: none; | |
| 42 width: 10px; | 34 width: 10px; |
| 43 height: 10px; | 35 height: 10px; |
| 44 border-radius: 5px; | 36 border-radius: 5px; |
| 45 background-color: black; | 37 background-color: black; |
| 46 margin: 2px;''' | 38 margin: 2px;''' |
| 47 ); | 39 ); |
| 48 | 40 |
| 49 Radio({ | 41 Radio({ |
| 50 Object key, | 42 Object key, |
| 51 this.onChanged, | 43 this.onChanged, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 highlight ? _highlightStyle : _style | 54 highlight ? _highlightStyle : _style |
| 63 ), | 55 ), |
| 64 onGestureTap: _handleClick | 56 onGestureTap: _handleClick |
| 65 ); | 57 ); |
| 66 } | 58 } |
| 67 | 59 |
| 68 void _handleClick(_) { | 60 void _handleClick(_) { |
| 69 onChanged(value); | 61 onChanged(value); |
| 70 } | 62 } |
| 71 } | 63 } |
| OLD | NEW |