mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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.
31 lines
700 B
Dart
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();
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|