| 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 'dart:sky' as sky; | 7 import 'dart:sky' as sky; |
| 8 import '../fn2.dart'; | 8 import '../fn2.dart'; |
| 9 import '../rendering/box.dart'; | 9 import '../rendering/box.dart'; |
| 10 import '../rendering/object.dart'; | 10 import '../rendering/object.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // TODO(jackson): This should change colors with the theme | 29 // TODO(jackson): This should change colors with the theme |
| 30 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000
0); | 30 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000
0); |
| 31 const double diameter = 16.0; | 31 const double diameter = 16.0; |
| 32 const double outerRadius = diameter / 2; | 32 const double outerRadius = diameter / 2; |
| 33 const double innerRadius = 5.0; | 33 const double innerRadius = 5.0; |
| 34 return new EventListenerNode( | 34 return new EventListenerNode( |
| 35 new Container( | 35 new Container( |
| 36 margin: const EdgeDims.symmetric(horizontal: 5.0), | 36 margin: const EdgeDims.symmetric(horizontal: 5.0), |
| 37 desiredSize: new sky.Size(diameter, diameter), | 37 desiredSize: new sky.Size(diameter, diameter), |
| 38 child: new CustomPaint( | 38 child: new CustomPaint( |
| 39 callback: (RenderObjectDisplayList canvas) { | 39 callback: (sky.Canvas canvas) { |
| 40 | 40 |
| 41 sky.Paint paint = new sky.Paint()..color = color; | 41 sky.Paint paint = new sky.Paint()..color = color; |
| 42 | 42 |
| 43 // Draw the outer circle | 43 // Draw the outer circle |
| 44 paint.style = 1; // SkPaint::STROKE_STYLE; | 44 paint.style = 1; // SkPaint::STROKE_STYLE; |
| 45 paint.strokeWidth = 2.0; | 45 paint.strokeWidth = 2.0; |
| 46 canvas.drawCircle(outerRadius, outerRadius, outerRadius, paint); | 46 canvas.drawCircle(outerRadius, outerRadius, outerRadius, paint); |
| 47 | 47 |
| 48 // Draw the inner circle | 48 // Draw the inner circle |
| 49 if (value == groupValue) { | 49 if (value == groupValue) { |
| 50 paint.style = 0; // SkPaint::FILL_STYLE; | 50 paint.style = 0; // SkPaint::FILL_STYLE; |
| 51 canvas.drawCircle(outerRadius, outerRadius, innerRadius, paint); | 51 canvas.drawCircle(outerRadius, outerRadius, innerRadius, paint); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 ) | 54 ) |
| 55 ), | 55 ), |
| 56 onGestureTap: _handleClick | 56 onGestureTap: _handleClick |
| 57 ); | 57 ); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void _handleClick(_) { | 60 void _handleClick(_) { |
| 61 onChanged(value); | 61 onChanged(value); |
| 62 } | 62 } |
| 63 } | 63 } |
| OLD | NEW |