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

Unified Diff: sky/framework/components/radio.dart

Issue 993033003: Move example fn widgets into sky/framework/components (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/components/menu_item.dart ('k') | sky/framework/components/toolbar.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/components/radio.dart
diff --git a/sky/examples/fn/widgets/radio.dart b/sky/framework/components/radio.dart
similarity index 65%
rename from sky/examples/fn/widgets/radio.dart
rename to sky/framework/components/radio.dart
index 240e5a2c19acc0ccb49b890e5510e4f2779b3e26..11e7e1c9428a0d4d1c129fcefe59532205269852 100644
--- a/sky/examples/fn/widgets/radio.dart
+++ b/sky/framework/components/radio.dart
@@ -1,12 +1,18 @@
-part of widgets;
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
-class Radio extends ButtonBase {
+import '../fn.dart';
+import 'button_base.dart';
+
+typedef void ValueChanged(value);
+class Radio extends ButtonBase {
Object value;
Object groupValue;
ValueChanged onChanged;
- static Style _style = new Style('''
+ static final Style _style = new Style('''
transform: translateX(0);
display: inline-block;
-webkit-user-select: none;
@@ -17,7 +23,7 @@ class Radio extends ButtonBase {
margin: 0 5px;'''
);
- static Style _highlightStyle = new Style('''
+ static final Style _highlightStyle = new Style('''
transform: translateX(0);
display: inline-block;
-webkit-user-select: none;
@@ -29,7 +35,7 @@ class Radio extends ButtonBase {
background-color: orange;'''
);
- static Style _dotStyle = new Style('''
+ static final Style _dotStyle = new Style('''
-webkit-user-select: none;
width: 10px;
height: 10px;
@@ -43,14 +49,16 @@ class Radio extends ButtonBase {
this.onChanged,
this.value,
this.groupValue
- }) : super(key: key);
+ }) : super(key: key) {
+ events.listen('click', _handleClick);
+ }
Node build() {
return new Container(
- style: _highlight ? _highlightStyle : _style,
+ style: highlight ? _highlightStyle : _style,
children: value == groupValue ?
[super.build(), new Container( style : _dotStyle )] : [super.build()]
- )..events.listen('click', _handleClick);
+ )
}
void _handleClick(_) {
« no previous file with comments | « sky/framework/components/menu_item.dart ('k') | sky/framework/components/toolbar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698