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

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

Issue 975863003: Don't hardcode the list of events types in fn (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: More careful event syncing 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 transform: translateX(0);
10 display: flex; 10 display: flex;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 border-right-width: 2px; 50 border-right-width: 2px;
51 border-bottom-width: 2px; 51 border-bottom-width: 2px;
52 border-color: #0f9d58;''' 52 border-color: #0f9d58;'''
53 ); 53 );
54 54
55 Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key); 55 Checkbox({ Object key, this.onChanged, this.checked }) : super(key: key);
56 56
57 Node render() { 57 Node render() {
58 return new Container( 58 return new Container(
59 style: _style, 59 style: _style,
60 onClick: _handleClick,
61 onPointerDown: _handlePointerDown,
62 onPointerUp: _handlePointerUp,
63 onPointerCancel: _handlePointerCancel,
64 children: [ 60 children: [
65 super.render(), 61 super.render(),
66 new Container( 62 new Container(
67 style: _highlight ? _containerHighlightStyle : _containerStyle, 63 style: _highlight ? _containerHighlightStyle : _containerStyle,
68 children: [ 64 children: [
69 new Container( 65 new Container(
70 style: checked ? _checkedStyle : _uncheckedStyle 66 style: checked ? _checkedStyle : _uncheckedStyle
71 ) 67 )
72 ] 68 ]
73 ) 69 )
74 ] 70 ]
75 ); 71 )..events.listen('click', _handleClick);
76 } 72 }
77 73
78 void _handleClick(sky.Event e) { 74 void _handleClick(sky.Event e) {
79 onChanged(!checked); 75 onChanged(!checked);
80 } 76 }
81 } 77 }
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