| 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 'package:sky/framework/theme2/colors.dart' as colors; | 5 import 'package:sky/framework/theme2/colors.dart' as colors; |
| 6 | 6 |
| 7 import '../fn2.dart'; | 7 import '../fn2.dart'; |
| 8 import '../rendering/object.dart'; | 8 import '../rendering/object.dart'; |
| 9 import 'button_base.dart'; | 9 import 'button_base.dart'; |
| 10 import 'ink_well.dart'; | 10 import 'ink_well.dart'; |
| 11 import 'dart:sky' as sky; | 11 import 'dart:sky' as sky; |
| 12 | 12 |
| 13 typedef void ValueChanged(value); | 13 typedef void ValueChanged(value); |
| 14 | 14 |
| 15 class Radio extends ButtonBase { | 15 class Radio extends ButtonBase { |
| 16 Object value; | |
| 17 Object groupValue; | |
| 18 ValueChanged onChanged; | |
| 19 | 16 |
| 20 Radio({ | 17 Radio({ |
| 21 Object key, | 18 Object key, |
| 22 this.onChanged, | 19 this.onChanged, |
| 23 this.value, | 20 this.value, |
| 24 this.groupValue | 21 this.groupValue |
| 25 }) : super(key: key); | 22 }) : super(key: key); |
| 26 | 23 |
| 24 Object value; |
| 25 Object groupValue; |
| 26 ValueChanged onChanged; |
| 27 |
| 27 UINode buildContent() { | 28 UINode buildContent() { |
| 28 // TODO(jackson): This should change colors with the theme | 29 // TODO(jackson): This should change colors with the theme |
| 29 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000); | 30 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000); |
| 30 const double diameter = 16.0; | 31 const double diameter = 16.0; |
| 31 const double outerRadius = diameter / 2; | 32 const double outerRadius = diameter / 2; |
| 32 const double innerRadius = 5.0; | 33 const double innerRadius = 5.0; |
| 33 return new EventListenerNode( | 34 return new EventListenerNode( |
| 34 new Container( | 35 new Container( |
| 35 margin: const EdgeDims.symmetric(horizontal: 5.0), | 36 margin: const EdgeDims.symmetric(horizontal: 5.0), |
| 36 width: diameter, | 37 width: diameter, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 } | 54 } |
| 54 ) | 55 ) |
| 55 ), | 56 ), |
| 56 onGestureTap: _handleClick | 57 onGestureTap: _handleClick |
| 57 ); | 58 ); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void _handleClick(_) { | 61 void _handleClick(_) { |
| 61 onChanged(value); | 62 onChanged(value); |
| 62 } | 63 } |
| 64 |
| 63 } | 65 } |
| OLD | NEW |