flutter_flutter/sdk/lib/widgets/icon_button.dart
Adam Barth 774d114c7e Use semantic names for callbacks instead of onGestureTap
Buttons and menu items use onPressed. Also, don't pass along the sky.Event
because that's a lower-level concept.

I've also reordered parameter lists to put the |child| argument last in a
number of places.

Also, fixed a bug where FloatingActionButton was missing syncFields.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1188993003.
2015-06-17 16:04:13 -07:00

31 lines
700 B
Dart

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../rendering/box.dart';
import 'basic.dart';
import 'icon.dart';
import 'widget.dart';
class IconButton extends Component {
IconButton({ String icon: '', this.onPressed })
: super(key: icon), icon = icon;
final String icon;
final Function onPressed;
Widget build() {
return new Listener(
child: new Padding(
child: new Icon(type: icon, size: 24),
padding: const EdgeDims.all(8.0)),
onGestureTap: (_) {
if (onPressed != null)
onPressed();
}
);
}
}