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

Side by Side Diff: sky/framework/components/button_base.dart

Issue 983903003: Re-work MaterialComponent (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase 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/framework/components/button.dart ('k') | sky/framework/components/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 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import '../fn.dart'; 5 import '../fn.dart';
6 import 'material.dart';
7 6
8 abstract class ButtonBase extends Material { 7 abstract class ButtonBase extends Component {
9 bool highlight = false; 8 bool highlight = false;
10 9
11 ButtonBase({ Object key }) : super(key: key) { 10 ButtonBase({ Object key }) : super(key: key) {
12 events.listen('pointerdown', _handlePointerDown); 11 events.listen('pointerdown', _handlePointerDown);
13 events.listen('pointerup', _handlePointerUp); 12 events.listen('pointerup', _handlePointerUp);
14 events.listen('pointercancel', _handlePointerCancel); 13 events.listen('pointercancel', _handlePointerCancel);
15 } 14 }
16 15
17 void _handlePointerDown(_) { 16 void _handlePointerDown(_) {
18 setState(() { 17 setState(() {
19 highlight = true; 18 highlight = true;
20 }); 19 });
21 } 20 }
22 void _handlePointerUp(_) { 21 void _handlePointerUp(_) {
23 setState(() { 22 setState(() {
24 highlight = false; 23 highlight = false;
25 }); 24 });
26 } 25 }
27 void _handlePointerCancel(_) { 26 void _handlePointerCancel(_) {
28 setState(() { 27 setState(() {
29 highlight = false; 28 highlight = false;
30 }); 29 });
31 } 30 }
32 } 31 }
OLDNEW
« no previous file with comments | « sky/framework/components/button.dart ('k') | sky/framework/components/checkbox.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698