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

Side by Side Diff: sky/examples/fn/widgets/checkbox.dart

Issue 974903005: attempt at making menuitems react (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rationalise my local client and upload the result 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 unified diff | Download patch
« no previous file with comments | « sky/examples/fn/widgets/buttonbase.dart ('k') | sky/examples/fn/widgets/drawer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of widgets; 1 part of widgets;
2 2
3 class Checkbox extends ButtonBase { 3 class Checkbox extends ButtonBase {
4 4
5 bool checked; 5 bool checked;
6 ValueChanged onChanged; 6 ValueChanged onChanged;
7 7
8 static Style _style = new Style(''' 8 static Style _style = new Style('''
9 transform: translateX(0);
9 display: flex; 10 display: flex;
10 justify-content: center; 11 justify-content: center;
11 align-items: center; 12 align-items: center;
12 -webkit-user-select: none; 13 -webkit-user-select: none;
13 cursor: pointer; 14 cursor: pointer;
14 width: 30px; 15 width: 30px;
15 height: 30px;''' 16 height: 30px;'''
16 ); 17 );
17 18
18 static Style _containerStyle = new Style(''' 19 static Style _containerStyle = new Style('''
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key); 55 Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key);
55 56
56 Node render() { 57 Node render() {
57 return new Container( 58 return new Container(
58 style: _style, 59 style: _style,
59 onClick: _handleClick, 60 onClick: _handleClick,
60 onPointerDown: _handlePointerDown, 61 onPointerDown: _handlePointerDown,
61 onPointerUp: _handlePointerUp, 62 onPointerUp: _handlePointerUp,
62 onPointerCancel: _handlePointerCancel, 63 onPointerCancel: _handlePointerCancel,
63 children: [ 64 children: [
65 super.render(),
64 new Container( 66 new Container(
65 style: _highlight ? _containerHighlightStyle : _containerStyle, 67 style: _highlight ? _containerHighlightStyle : _containerStyle,
66 children: [ 68 children: [
67 new Container( 69 new Container(
68 style: checked ? _checkedStyle : _uncheckedStyle 70 style: checked ? _checkedStyle : _uncheckedStyle
69 ) 71 )
70 ] 72 ]
71 ) 73 )
72 ] 74 ]
73 ); 75 );
74 } 76 }
75 77
76 void _handleClick(sky.Event e) { 78 void _handleClick(sky.Event e) {
77 onChanged(!checked); 79 onChanged(!checked);
78 } 80 }
79 } 81 }
OLDNEW
« no previous file with comments | « sky/examples/fn/widgets/buttonbase.dart ('k') | sky/examples/fn/widgets/drawer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698