| 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'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 UINode buildContent() { | 27 UINode buildContent() { |
| 28 // TODO(jackson): This should change colors with the theme | 28 // TODO(jackson): This should change colors with the theme |
| 29 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000); | 29 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000); |
| 30 const double diameter = 16.0; | 30 const double diameter = 16.0; |
| 31 const double outerRadius = diameter / 2; | 31 const double outerRadius = diameter / 2; |
| 32 const double innerRadius = 5.0; | 32 const double innerRadius = 5.0; |
| 33 return new EventListenerNode( | 33 return new EventListenerNode( |
| 34 new Container( | 34 new Container( |
| 35 margin: const EdgeDims.symmetric(horizontal: 5.0), | 35 margin: const EdgeDims.symmetric(horizontal: 5.0), |
| 36 desiredSize: new Size(diameter, diameter), | 36 width: diameter, |
| 37 height: diameter, |
| 37 child: new CustomPaint( | 38 child: new CustomPaint( |
| 38 callback: (sky.Canvas canvas) { | 39 callback: (sky.Canvas canvas) { |
| 39 | 40 |
| 40 Paint paint = new Paint()..color = color; | 41 Paint paint = new Paint()..color = color; |
| 41 | 42 |
| 42 // Draw the outer circle | 43 // Draw the outer circle |
| 43 paint.setStyle(sky.PaintingStyle.stroke); | 44 paint.setStyle(sky.PaintingStyle.stroke); |
| 44 paint.strokeWidth = 2.0; | 45 paint.strokeWidth = 2.0; |
| 45 canvas.drawCircle(outerRadius, outerRadius, outerRadius, paint); | 46 canvas.drawCircle(outerRadius, outerRadius, outerRadius, paint); |
| 46 | 47 |
| 47 // Draw the inner circle | 48 // Draw the inner circle |
| 48 if (value == groupValue) { | 49 if (value == groupValue) { |
| 49 paint.setStyle(sky.PaintingStyle.fill); | 50 paint.setStyle(sky.PaintingStyle.fill); |
| 50 canvas.drawCircle(outerRadius, outerRadius, innerRadius, paint); | 51 canvas.drawCircle(outerRadius, outerRadius, innerRadius, paint); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 ) | 54 ) |
| 54 ), | 55 ), |
| 55 onGestureTap: _handleClick | 56 onGestureTap: _handleClick |
| 56 ); | 57 ); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void _handleClick(_) { | 60 void _handleClick(_) { |
| 60 onChanged(value); | 61 onChanged(value); |
| 61 } | 62 } |
| 62 } | 63 } |
| OLD | NEW |