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

Side by Side Diff: sky/sdk/lib/widgets/floating_action_button.dart

Issue 1188993003: Use semantic names for callbacks instead of onGestureTap (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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/stocks2/lib/stock_settings.dart ('k') | sky/sdk/lib/widgets/icon_button.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 '../theme2/colors.dart'; 5 import '../theme2/colors.dart';
6 import '../theme2/edges.dart'; 6 import '../theme2/edges.dart';
7 import 'basic.dart'; 7 import 'basic.dart';
8 import 'button_base.dart'; 8 import 'button_base.dart';
9 import 'ink_well.dart'; 9 import 'ink_well.dart';
10 import 'material.dart'; 10 import 'material.dart';
11 11
12 // TODO(eseidel): This needs to change based on device size? 12 // TODO(eseidel): This needs to change based on device size?
13 // http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylin es-keylines-spacing 13 // http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylin es-keylines-spacing
14 const double _kSize = 56.0; 14 const double _kSize = 56.0;
15 15
16 class FloatingActionButton extends ButtonBase { 16 class FloatingActionButton extends ButtonBase {
17 17
18 FloatingActionButton({ String key, this.child }) : super(key: key); 18 FloatingActionButton({
19 String key,
20 this.child,
21 this.enabled: true,
Hixie 2015/06/17 22:59:21 either remove this or make it affect the UI
abarth-chromium 2015/06/17 23:04:04 Removed.
22 Function onPressed
23 }) : super(key: key);
19 24
20 final Widget child; 25 bool enabled;
26 Widget child;
27 Function onPressed;
28
29 void syncFields(FloatingActionButton source) {
30 enabled = source.enabled;
31 child = source.child;
32 onPressed = source.onPressed;
33 }
Hixie 2015/06/17 22:59:21 call the superclass.
abarth-chromium 2015/06/17 23:04:04 Done.
21 34
22 Widget buildContent() { 35 Widget buildContent() {
23 return new Material( 36 return new Material(
24 child: new ClipOval(
25 child: new Container(
26 width: _kSize,
27 height: _kSize,
28 child: new InkWell(child: new Center(child: child))
29 )
30 ),
31 color: Red[500], 37 color: Red[500],
32 edge: MaterialEdge.circle, 38 edge: MaterialEdge.circle,
33 level: highlight ? 3 : 2 39 level: highlight ? 3 : 2,
40 child: new ClipOval(
41 child: new Listener(
42 onGestureTap: (_) {
43 if (onPressed != null && enabled)
44 onPressed();
45 },
46 child: new Container(
47 width: _kSize,
48 height: _kSize,
49 child: new InkWell(child: new Center(child: child))
50 )
51 )
52 )
34 ); 53 );
35 } 54 }
36 55
37 } 56 }
OLDNEW
« no previous file with comments | « sky/examples/stocks2/lib/stock_settings.dart ('k') | sky/sdk/lib/widgets/icon_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698