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

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

Issue 1161323004: Export Point, Size, Rect, Color, Paint, Path, BoxDecoration, Border, BorderSide, EdgeDims, and Flex… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: without analyser changes 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;
8 import '../fn2.dart'; 7 import '../fn2.dart';
9 import '../rendering/box.dart';
10 import '../rendering/object.dart'; 8 import '../rendering/object.dart';
11 import 'button_base.dart'; 9 import 'button_base.dart';
12 import 'ink_well.dart'; 10 import 'ink_well.dart';
13 11
14 typedef void ValueChanged(value); 12 typedef void ValueChanged(value);
15 13
16 class Radio extends ButtonBase { 14 class Radio extends ButtonBase {
17 Object value; 15 Object value;
18 Object groupValue; 16 Object groupValue;
19 ValueChanged onChanged; 17 ValueChanged onChanged;
20 18
21 Radio({ 19 Radio({
22 Object key, 20 Object key,
23 this.onChanged, 21 this.onChanged,
24 this.value, 22 this.value,
25 this.groupValue 23 this.groupValue
26 }) : super(key: key); 24 }) : super(key: key);
27 25
28 UINode buildContent() { 26 UINode buildContent() {
29 // TODO(jackson): This should change colors with the theme 27 // TODO(jackson): This should change colors with the theme
30 sky.Color color = highlight ? colors.Purple[500] : const sky.Color(0x8A00000 0); 28 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000);
31 const double diameter = 16.0; 29 const double diameter = 16.0;
32 const double outerRadius = diameter / 2; 30 const double outerRadius = diameter / 2;
33 const double innerRadius = 5.0; 31 const double innerRadius = 5.0;
34 return new EventListenerNode( 32 return new EventListenerNode(
35 new Container( 33 new Container(
36 margin: const EdgeDims.symmetric(horizontal: 5.0), 34 margin: const EdgeDims.symmetric(horizontal: 5.0),
37 desiredSize: new sky.Size(diameter, diameter), 35 desiredSize: new Size(diameter, diameter),
38 child: new CustomPaint( 36 child: new CustomPaint(
39 callback: (sky.Canvas canvas) { 37 callback: (sky.Canvas canvas) {
40 38
41 sky.Paint paint = new sky.Paint()..color = color; 39 Paint paint = new Paint()..color = color;
42 40
43 // Draw the outer circle 41 // Draw the outer circle
44 paint.style = 1; // SkPaint::STROKE_STYLE; 42 paint.style = 1; // SkPaint::STROKE_STYLE;
45 paint.strokeWidth = 2.0; 43 paint.strokeWidth = 2.0;
46 canvas.drawCircle(outerRadius, outerRadius, outerRadius, paint); 44 canvas.drawCircle(outerRadius, outerRadius, outerRadius, paint);
47 45
48 // Draw the inner circle 46 // Draw the inner circle
49 if (value == groupValue) { 47 if (value == groupValue) {
50 paint.style = 0; // SkPaint::FILL_STYLE; 48 paint.style = 0; // SkPaint::FILL_STYLE;
51 canvas.drawCircle(outerRadius, outerRadius, innerRadius, paint); 49 canvas.drawCircle(outerRadius, outerRadius, innerRadius, paint);
52 } 50 }
53 } 51 }
54 ) 52 )
55 ), 53 ),
56 onGestureTap: _handleClick 54 onGestureTap: _handleClick
57 ); 55 );
58 } 56 }
59 57
60 void _handleClick(_) { 58 void _handleClick(_) {
61 onChanged(value); 59 onChanged(value);
62 } 60 }
63 } 61 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/menu_item.dart ('k') | sky/sdk/lib/framework/components2/scaffold.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698