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

Side by Side Diff: sky/examples/fn/widgets/buttonbase.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/button.dart ('k') | sky/examples/fn/widgets/checkbox.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 abstract class ButtonBase extends MaterialComponent { 3 abstract class ButtonBase extends MaterialComponent {
4 4
5 bool _highlight = false; 5 bool _highlight = false;
6 6
7 ButtonBase({ Object key }) : super(key: key); 7 ButtonBase({ Object key }) : super(key: key) {
8 events.listen('pointerdown', _handlePointerDown);
9 events.listen('pointerup', _handlePointerUp);
10 events.listen('pointercancel', _handlePointerCancel);
11 }
8 12
9 void _handlePointerDown(_) { 13 void _handlePointerDown(_) {
10 setState(() { 14 setState(() {
11 _highlight = true; 15 _highlight = true;
12 }); 16 });
13 } 17 }
14 void _handlePointerUp(_) { 18 void _handlePointerUp(_) {
15 setState(() { 19 setState(() {
16 _highlight = false; 20 _highlight = false;
17 }); 21 });
18 } 22 }
19 void _handlePointerCancel(_) { 23 void _handlePointerCancel(_) {
20 setState(() { 24 setState(() {
21 _highlight = false; 25 _highlight = false;
22 }); 26 });
23 } 27 }
24 } 28 }
OLDNEW
« no previous file with comments | « sky/examples/fn/widgets/button.dart ('k') | sky/examples/fn/widgets/checkbox.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698