OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 import '../fn2.dart'; | |
6 | |
7 abstract class ButtonBase extends Component { | |
8 | |
9 ButtonBase({ Object key, this.highlight: false }) : super(key: key); | |
10 | |
11 bool highlight; | |
12 | |
13 void syncFields(ButtonBase source) { | |
14 highlight = source.highlight; | |
15 } | |
16 | |
17 void _handlePointerDown(_) { | |
18 setState(() { | |
19 highlight = true; | |
20 }); | |
21 } | |
22 void _handlePointerUp(_) { | |
23 setState(() { | |
24 highlight = false; | |
25 }); | |
26 } | |
27 void _handlePointerCancel(_) { | |
28 setState(() { | |
29 highlight = false; | |
30 }); | |
31 } | |
32 | |
33 UINode build() { | |
34 return new EventListenerNode( | |
35 buildContent(), | |
36 onPointerDown: _handlePointerDown, | |
37 onPointerUp: _handlePointerUp, | |
38 onPointerCancel: _handlePointerCancel | |
39 ); | |
40 } | |
41 | |
42 UINode buildContent(); | |
43 | |
44 } | |
OLD | NEW |