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

Side by Side Diff: sky/framework/components/radio.dart

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « sky/framework/components/popup_menu_item.dart ('k') | sky/framework/components/scaffold.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 import '../fn.dart';
6 import 'button_base.dart';
7 import 'ink_well.dart';
8
9 typedef void ValueChanged(value);
10
11 class Radio extends ButtonBase {
12 Object value;
13 Object groupValue;
14 ValueChanged onChanged;
15
16 static final Style _style = new Style('''
17 width: 14px;
18 height: 14px;
19 border-radius: 7px;
20 border: 1px solid blue;
21 margin: 0 5px;'''
22 );
23
24 static final Style _highlightStyle = new Style('''
25 width: 14px;
26 height: 14px;
27 border-radius: 7px;
28 border: 1px solid blue;
29 margin: 0 5px;
30 background-color: orange;'''
31 );
32
33 static final Style _dotStyle = new Style('''
34 width: 10px;
35 height: 10px;
36 border-radius: 5px;
37 background-color: black;
38 margin: 2px;'''
39 );
40
41 Radio({
42 Object key,
43 this.onChanged,
44 this.value,
45 this.groupValue
46 }) : super(key: key);
47
48 UINode buildContent() {
49 return new EventListenerNode(
50 new StyleNode(
51 new InkWell(
52 children: value == groupValue ? [new Container(style: _dotStyle)] : []
53 ),
54 highlight ? _highlightStyle : _style
55 ),
56 onGestureTap: _handleClick
57 );
58 }
59
60 void _handleClick(_) {
61 onChanged(value);
62 }
63 }
OLDNEW
« no previous file with comments | « sky/framework/components/popup_menu_item.dart ('k') | sky/framework/components/scaffold.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698