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

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

Issue 1174023003: Remove one more use of mirrors: Components now have to explicitly sync their fields. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 '../fn2.dart'; 7 import '../fn2.dart';
8 import '../rendering/object.dart'; 8 import '../rendering/object.dart';
9 import 'button_base.dart'; 9 import 'button_base.dart';
10 import 'ink_well.dart'; 10 import 'ink_well.dart';
11 import 'dart:sky' as sky; 11 import 'dart:sky' as sky;
12 12
13 typedef void ValueChanged(value); 13 typedef void ValueChanged(value);
14 14
15 class Radio extends ButtonBase { 15 class Radio extends ButtonBase {
16 16
17 Radio({ 17 Radio({
18 Object key, 18 Object key,
19 this.onChanged,
20 this.value, 19 this.value,
21 this.groupValue 20 this.groupValue,
21 this.onChanged
22 }) : super(key: key); 22 }) : super(key: key);
23 23
24 Object value; 24 Object value;
25 Object groupValue; 25 Object groupValue;
26 ValueChanged onChanged; 26 ValueChanged onChanged;
27 27
28 void syncFields(Radio source) {
29 value = source.value;
30 groupValue = source.groupValue;
31 onChanged = source.onChanged;
32 super.syncFields(source);
33 }
34
28 UINode buildContent() { 35 UINode buildContent() {
29 // TODO(jackson): This should change colors with the theme 36 // TODO(jackson): This should change colors with the theme
30 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000); 37 Color color = highlight ? colors.Purple[500] : const Color(0x8A000000);
31 const double diameter = 16.0; 38 const double diameter = 16.0;
32 const double outerRadius = diameter / 2; 39 const double outerRadius = diameter / 2;
33 const double innerRadius = 5.0; 40 const double innerRadius = 5.0;
34 return new EventListenerNode( 41 return new EventListenerNode(
35 new Container( 42 new Container(
36 margin: const EdgeDims.symmetric(horizontal: 5.0), 43 margin: const EdgeDims.symmetric(horizontal: 5.0),
37 width: diameter, 44 width: diameter,
(...skipping 18 matching lines...) Expand all
56 ), 63 ),
57 onGestureTap: _handleClick 64 onGestureTap: _handleClick
58 ); 65 );
59 } 66 }
60 67
61 void _handleClick(_) { 68 void _handleClick(_) {
62 onChanged(value); 69 onChanged(value);
63 } 70 }
64 71
65 } 72 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/popup_menu_item.dart ('k') | sky/sdk/lib/framework/components2/scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698