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

Unified Diff: sky/examples/fn/widgets/radio.dart

Issue 971183002: Initial commit of Effen reactive framework experiment for Sky (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/examples/fn/widgets/menuitem.dart ('k') | sky/examples/fn/widgets/toolbar.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/fn/widgets/radio.dart
diff --git a/sky/examples/fn/widgets/radio.dart b/sky/examples/fn/widgets/radio.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bdcc5b1c1364b1e01458d941110114c0f468eaf2
--- /dev/null
+++ b/sky/examples/fn/widgets/radio.dart
@@ -0,0 +1,61 @@
+part of widgets;
+
+class Radio extends ButtonBase {
+
+ Object value;
+ Object groupValue;
+ ValueChanged onChanged;
+
+ static Style _style = new Style('''
+ display: inline-block;
+ -webkit-user-select: none;
+ width: 14px;
+ height: 14px;
+ border-radius: 7px;
+ border: 1px solid blue;
+ margin: 0 5px;'''
+ );
+
+ static Style _highlightStyle = new Style('''
+ display: inline-block;
+ -webkit-user-select: none;
+ width: 14px;
+ height: 14px;
+ border-radius: 7px;
+ border: 1px solid blue;
+ margin: 0 5px;
+ background-color: orange;'''
+ );
+
+ static Style _dotStyle = new Style('''
+ -webkit-user-select: none;
+ width: 10px;
+ height: 10px;
+ border-radius: 5px;
+ background-color: black;
+ margin: 2px;'''
+ );
+
+ Radio({
+ Object key,
+ this.onChanged,
+ this.value,
+ this.groupValue
+ }) : super(key: key);
+
+ Node render() {
+ return new Container(
+ style: _highlight ? _highlightStyle : _style,
+ onClick: _handleClick,
+ onPointerDown: _handlePointerDown,
+ onPointerUp: _handlePointerUp,
+ onPointerCancel: _handlePointerCancel,
+ children: value == groupValue ?
+ [new Container( style : _dotStyle )] : null
+ );
+ }
+
+ void _handleClick(sky.Event e) {
+ onChanged(value);
+ }
+}
« no previous file with comments | « sky/examples/fn/widgets/menuitem.dart ('k') | sky/examples/fn/widgets/toolbar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698