OLD | NEW |
1 part of widgets; | 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. |
2 | 4 |
3 abstract class ButtonBase extends MaterialComponent { | 5 import '../fn.dart'; |
| 6 import 'material.dart'; |
4 | 7 |
5 bool _highlight = false; | 8 abstract class ButtonBase extends Material { |
| 9 bool highlight = false; |
6 | 10 |
7 ButtonBase({ Object key }) : super(key: key) { | 11 ButtonBase({ Object key }) : super(key: key) { |
8 events.listen('pointerdown', _handlePointerDown); | 12 events.listen('pointerdown', _handlePointerDown); |
9 events.listen('pointerup', _handlePointerUp); | 13 events.listen('pointerup', _handlePointerUp); |
10 events.listen('pointercancel', _handlePointerCancel); | 14 events.listen('pointercancel', _handlePointerCancel); |
11 } | 15 } |
12 | 16 |
13 void _handlePointerDown(_) { | 17 void _handlePointerDown(_) { |
14 setState(() { | 18 setState(() { |
15 _highlight = true; | 19 highlight = true; |
16 }); | 20 }); |
17 } | 21 } |
18 void _handlePointerUp(_) { | 22 void _handlePointerUp(_) { |
19 setState(() { | 23 setState(() { |
20 _highlight = false; | 24 highlight = false; |
21 }); | 25 }); |
22 } | 26 } |
23 void _handlePointerCancel(_) { | 27 void _handlePointerCancel(_) { |
24 setState(() { | 28 setState(() { |
25 _highlight = false; | 29 highlight = false; |
26 }); | 30 }); |
27 } | 31 } |
28 } | 32 } |
OLD | NEW |