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 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 UINode buildContent() { | 26 UINode buildContent() { |
27 // TODO(jackson): This should change colors with the theme | 27 // TODO(jackson): This should change colors with the theme |
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 width: edgeSize + 2.0, |
| 35 height: edgeSize + 2.0, |
35 child: new CustomPaint( | 36 child: new CustomPaint( |
36 callback: (sky.Canvas canvas) { | 37 callback: (sky.Canvas canvas) { |
37 | 38 |
38 sky.Paint paint = new sky.Paint()..color = color | 39 sky.Paint paint = new sky.Paint()..color = color |
39 ..isAntiAlias = true | 40 ..isAntiAlias = true |
40 ..strokeWidth = 2.0; | 41 ..strokeWidth = 2.0; |
41 | 42 |
42 // Draw the outer rrect | 43 // Draw the outer rrect |
43 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint
ingStyle.stroke); | 44 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint
ingStyle.stroke); |
44 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize); | 45 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize); |
(...skipping 11 matching lines...) Expand all Loading... |
56 path.lineTo(edgeSize * 0.8, edgeSize * 0.3); | 57 path.lineTo(edgeSize * 0.8, edgeSize * 0.3); |
57 canvas.drawPath(path, paint); | 58 canvas.drawPath(path, paint); |
58 } | 59 } |
59 } | 60 } |
60 ) | 61 ) |
61 ), | 62 ), |
62 onGestureTap: _handleClick | 63 onGestureTap: _handleClick |
63 ); | 64 ); |
64 } | 65 } |
65 } | 66 } |
OLD | NEW |