Commit d6dc9d47 authored by Adam Barth's avatar Adam Barth

Use VoidCallback for onPressed and friends

Previous these callbacks were leaking the implementation detail that they were
triggered by taps. In a later patch, we're going to add a parameter to
GestureTapCallback that these callbacks won't have.

Related to #1807
parent 93622ebd
...@@ -141,7 +141,7 @@ class TextureButton extends StatefulComponent { ...@@ -141,7 +141,7 @@ class TextureButton extends StatefulComponent {
this.height: 128.0 this.height: 128.0
}) : super(key: key); }) : super(key: key);
final GestureTapCallback onPressed; final VoidCallback onPressed;
final Texture texture; final Texture texture;
final Texture textureDown; final Texture textureDown;
final double width; final double width;
......
...@@ -48,7 +48,7 @@ class Dialog extends StatelessComponent { ...@@ -48,7 +48,7 @@ class Dialog extends StatelessComponent {
final List<Widget> actions; final List<Widget> actions;
/// An (optional) callback that is called when the dialog is dismissed. /// An (optional) callback that is called when the dialog is dismissed.
final GestureTapCallback onDismiss; final VoidCallback onDismiss;
Color _getColor(BuildContext context) { Color _getColor(BuildContext context) {
switch (Theme.of(context).brightness) { switch (Theme.of(context).brightness) {
......
...@@ -15,7 +15,7 @@ class DrawerItem extends StatelessComponent { ...@@ -15,7 +15,7 @@ class DrawerItem extends StatelessComponent {
final String icon; final String icon;
final Widget child; final Widget child;
final GestureTapCallback onPressed; final VoidCallback onPressed;
final bool selected; final bool selected;
TextStyle _getTextStyle(ThemeData themeData) { TextStyle _getTextStyle(ThemeData themeData) {
......
...@@ -12,7 +12,7 @@ class FlatButton extends MaterialButton { ...@@ -12,7 +12,7 @@ class FlatButton extends MaterialButton {
FlatButton({ FlatButton({
Key key, Key key,
Widget child, Widget child,
GestureTapCallback onPressed VoidCallback onPressed
}) : super(key: key, }) : super(key: key,
child: child, child: child,
onPressed: onPressed); onPressed: onPressed);
......
...@@ -24,7 +24,7 @@ class FloatingActionButton extends StatefulComponent { ...@@ -24,7 +24,7 @@ class FloatingActionButton extends StatefulComponent {
final Widget child; final Widget child;
final Color backgroundColor; final Color backgroundColor;
final GestureTapCallback onPressed; final VoidCallback onPressed;
_FloatingActionButtonState createState() => new _FloatingActionButtonState(); _FloatingActionButtonState createState() => new _FloatingActionButtonState();
} }
......
...@@ -19,7 +19,7 @@ class IconButton extends StatelessComponent { ...@@ -19,7 +19,7 @@ class IconButton extends StatelessComponent {
final String icon; final String icon;
final IconThemeColor color; final IconThemeColor color;
final ColorFilter colorFilter; final ColorFilter colorFilter;
final GestureTapCallback onPressed; final VoidCallback onPressed;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
......
...@@ -42,7 +42,7 @@ abstract class MaterialButton extends StatefulComponent { ...@@ -42,7 +42,7 @@ abstract class MaterialButton extends StatefulComponent {
final Widget child; final Widget child;
final ButtonColor textColor; final ButtonColor textColor;
final GestureTapCallback onPressed; final VoidCallback onPressed;
bool get enabled => onPressed != null; bool get enabled => onPressed != null;
......
...@@ -20,7 +20,7 @@ class SnackBarAction extends StatelessComponent { ...@@ -20,7 +20,7 @@ class SnackBarAction extends StatelessComponent {
} }
final String label; final String label;
final GestureTapCallback onPressed; final VoidCallback onPressed;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
......
...@@ -305,7 +305,7 @@ class Tab extends StatelessComponent { ...@@ -305,7 +305,7 @@ class Tab extends StatelessComponent {
assert(label.text != null || label.icon != null); assert(label.text != null || label.icon != null);
} }
final GestureTapCallback onSelected; final VoidCallback onSelected;
final TabLabel label; final TabLabel label;
final Color color; final Color color;
final bool selected; final bool selected;
......
...@@ -12,4 +12,5 @@ export 'dart:ui' show ...@@ -12,4 +12,5 @@ export 'dart:ui' show
Point, Point,
Rect, Rect,
Size, Size,
TransferMode; TransferMode,
VoidCallback;
...@@ -55,8 +55,9 @@ export 'package:flutter/rendering.dart' show ...@@ -55,8 +55,9 @@ export 'package:flutter/rendering.dart' show
TextStyle, TextStyle,
TransferMode, TransferMode,
ValueChanged, ValueChanged,
normal, VoidCallback,
bold, bold,
normal,
underline, underline,
overline, overline,
lineThrough; lineThrough;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment