Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: sky/sdk/lib/framework/components2/checkbox.dart

Issue 1175353002: Make the popup menu animation correct (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: style guide update Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 super.syncFields(source); 25 super.syncFields(source);
26 } 26 }
27 27
28 void _handleClick(sky.Event e) { 28 void _handleClick(sky.Event e) {
29 onChanged(!checked); 29 onChanged(!checked);
30 } 30 }
31 31
32 UINode buildContent() { 32 UINode buildContent() {
33 // TODO(jackson): This should change colors with the theme 33 // TODO(jackson): This should change colors with the theme
34 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000 0); 34 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000 0);
35 const double edgeSize = 20.0; 35 const double kEdgeSize = 20.0;
36 const double edgeRadius = 1.0; 36 const double kEdgeRadius = 1.0;
37 return new EventListenerNode( 37 return new EventListenerNode(
38 new Container( 38 new Container(
39 margin: const EdgeDims.symmetric(horizontal: 5.0), 39 margin: const EdgeDims.symmetric(horizontal: 5.0),
40 width: edgeSize + 2.0, 40 width: kEdgeSize + 2.0,
41 height: edgeSize + 2.0, 41 height: kEdgeSize + 2.0,
42 child: new CustomPaint( 42 child: new CustomPaint(
43 callback: (sky.Canvas canvas) { 43 callback: (sky.Canvas canvas, Size size) {
44 44
45 sky.Paint paint = new sky.Paint()..color = color 45 sky.Paint paint = new sky.Paint()..color = color
46 ..strokeWidth = 2.0; 46 ..strokeWidth = 2.0;
47 47
48 // Draw the outer rrect 48 // Draw the outer rrect
49 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint ingStyle.stroke); 49 paint.setStyle(checked ? sky.PaintingStyle.strokeAndFill : sky.Paint ingStyle.stroke);
50 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, edgeSize, edgeSize); 50 sky.Rect rect = new sky.Rect.fromLTRB(0.0, 0.0, kEdgeSize, kEdgeSize );
51 sky.RRect rrect = new sky.RRect()..setRectXY(rect, edgeRadius, edgeR adius); 51 sky.RRect rrect = new sky.RRect()..setRectXY(rect, kEdgeRadius, kEdg eRadius);
52 canvas.drawRRect(rrect, paint); 52 canvas.drawRRect(rrect, paint);
53 53
54 // Draw the inner check 54 // Draw the inner check
55 if (checked) { 55 if (checked) {
56 // TODO(jackson): Use the theme color 56 // TODO(jackson): Use the theme color
57 paint.color = const sky.Color(0xFFFFFFFF); 57 paint.color = const sky.Color(0xFFFFFFFF);
58 paint.setStyle(sky.PaintingStyle.stroke); 58 paint.setStyle(sky.PaintingStyle.stroke);
59 sky.Path path = new sky.Path(); 59 sky.Path path = new sky.Path();
60 path.moveTo(edgeSize * 0.2, edgeSize * 0.5); 60 path.moveTo(kEdgeSize * 0.2, kEdgeSize * 0.5);
61 path.lineTo(edgeSize * 0.4, edgeSize * 0.7); 61 path.lineTo(kEdgeSize * 0.4, kEdgeSize * 0.7);
62 path.lineTo(edgeSize * 0.8, edgeSize * 0.3); 62 path.lineTo(kEdgeSize * 0.8, kEdgeSize * 0.3);
63 canvas.drawPath(path, paint); 63 canvas.drawPath(path, paint);
64 } 64 }
65 } 65 }
66 ) 66 )
67 ), 67 ),
68 onGestureTap: _handleClick 68 onGestureTap: _handleClick
69 ); 69 );
70 } 70 }
71 71
72 } 72 }
OLDNEW
« no previous file with comments | « sky/examples/stocks2/lib/stock_arrow.dart ('k') | sky/sdk/lib/framework/components2/floating_action_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698