| 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 17 matching lines...) Expand all Loading... |
| 28 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000
0); | 28 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000
0); |
| 29 const double edgeSize = 20.0; | 29 const double edgeSize = 20.0; |
| 30 const double edgeRadius = 1.0; | 30 const double edgeRadius = 1.0; |
| 31 return new EventListenerNode( | 31 return new EventListenerNode( |
| 32 new Container( | 32 new Container( |
| 33 margin: const EdgeDims.symmetric(horizontal: 5.0), | 33 margin: const EdgeDims.symmetric(horizontal: 5.0), |
| 34 desiredSize: new sky.Size(edgeSize + 2.0, edgeSize + 2.0), | 34 desiredSize: new sky.Size(edgeSize + 2.0, edgeSize + 2.0), |
| 35 child: new CustomPaint( | 35 child: new CustomPaint( |
| 36 callback: (sky.Canvas canvas) { | 36 callback: (sky.Canvas canvas) { |
| 37 | 37 |
| 38 sky.Paint paint = new sky.Paint()..color = color; | 38 sky.Paint paint = new sky.Paint()..color = color |
| 39 ..isAntiAlias = true; | 39 ..isAntiAlias = true |
| 40 ..strokeWidth = 2.0; | 40 ..strokeWidth = 2.0; |
| 41 | 41 |
| 42 // Draw the outer rrect | 42 // Draw the outer rrect |
| 43 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint
ingStyle.stroke); | 43 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint
ingStyle.stroke); |
| 44 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize); | 44 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize); |
| 45 sky.RRect rrect = new sky.RRect()..setRectXY(rect, edgeRadius, edgeR
adius); | 45 sky.RRect rrect = new sky.RRect()..setRectXY(rect, edgeRadius, edgeR
adius); |
| 46 canvas.drawRRect(rrect, paint); | 46 canvas.drawRRect(rrect, paint); |
| 47 | 47 |
| 48 // Draw the inner check | 48 // Draw the inner check |
| 49 if (checked) { | 49 if (checked) { |
| 50 // TODO(jackson): Use the theme color | 50 // TODO(jackson): Use the theme color |
| 51 paint.color = const sky.Color(0xFFFFFFFF); | 51 paint.color = const sky.Color(0xFFFFFFFF); |
| 52 paint.setStyle(sky.PaintingStyle.stroke); | 52 paint.setStyle(sky.PaintingStyle.stroke); |
| 53 sky.Path path = new sky.Path(); | 53 sky.Path path = new sky.Path(); |
| 54 path.moveTo(edgeSize * 0.2, edgeSize * 0.5); | 54 path.moveTo(edgeSize * 0.2, edgeSize * 0.5); |
| 55 path.lineTo(edgeSize * 0.4, edgeSize * 0.7); | 55 path.lineTo(edgeSize * 0.4, edgeSize * 0.7); |
| 56 path.lineTo(edgeSize * 0.8, edgeSize * 0.3); | 56 path.lineTo(edgeSize * 0.8, edgeSize * 0.3); |
| 57 canvas.drawPath(path, paint); | 57 canvas.drawPath(path, paint); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 ) | 60 ) |
| 61 ), | 61 ), |
| 62 onGestureTap: _handleClick | 62 onGestureTap: _handleClick |
| 63 ); | 63 ); |
| 64 } | 64 } |
| 65 } | 65 } |
| OLD | NEW |