OLD | NEW |
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 } |
OLD | NEW |