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
This commit is contained in:
@@ -141,7 +141,7 @@ class TextureButton extends StatefulComponent {
|
||||
this.height: 128.0
|
||||
}) : super(key: key);
|
||||
|
||||
final GestureTapCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
final Texture texture;
|
||||
final Texture textureDown;
|
||||
final double width;
|
||||
|
||||
@@ -48,7 +48,7 @@ class Dialog extends StatelessComponent {
|
||||
final List<Widget> actions;
|
||||
|
||||
/// An (optional) callback that is called when the dialog is dismissed.
|
||||
final GestureTapCallback onDismiss;
|
||||
final VoidCallback onDismiss;
|
||||
|
||||
Color _getColor(BuildContext context) {
|
||||
switch (Theme.of(context).brightness) {
|
||||
|
||||
@@ -15,7 +15,7 @@ class DrawerItem extends StatelessComponent {
|
||||
|
||||
final String icon;
|
||||
final Widget child;
|
||||
final GestureTapCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
final bool selected;
|
||||
|
||||
TextStyle _getTextStyle(ThemeData themeData) {
|
||||
|
||||
@@ -12,7 +12,7 @@ class FlatButton extends MaterialButton {
|
||||
FlatButton({
|
||||
Key key,
|
||||
Widget child,
|
||||
GestureTapCallback onPressed
|
||||
VoidCallback onPressed
|
||||
}) : super(key: key,
|
||||
child: child,
|
||||
onPressed: onPressed);
|
||||
|
||||
@@ -24,7 +24,7 @@ class FloatingActionButton extends StatefulComponent {
|
||||
|
||||
final Widget child;
|
||||
final Color backgroundColor;
|
||||
final GestureTapCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
_FloatingActionButtonState createState() => new _FloatingActionButtonState();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class IconButton extends StatelessComponent {
|
||||
final String icon;
|
||||
final IconThemeColor color;
|
||||
final ColorFilter colorFilter;
|
||||
final GestureTapCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new GestureDetector(
|
||||
|
||||
@@ -42,7 +42,7 @@ abstract class MaterialButton extends StatefulComponent {
|
||||
|
||||
final Widget child;
|
||||
final ButtonColor textColor;
|
||||
final GestureTapCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
bool get enabled => onPressed != null;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class SnackBarAction extends StatelessComponent {
|
||||
}
|
||||
|
||||
final String label;
|
||||
final GestureTapCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new GestureDetector(
|
||||
|
||||
@@ -305,7 +305,7 @@ class Tab extends StatelessComponent {
|
||||
assert(label.text != null || label.icon != null);
|
||||
}
|
||||
|
||||
final GestureTapCallback onSelected;
|
||||
final VoidCallback onSelected;
|
||||
final TabLabel label;
|
||||
final Color color;
|
||||
final bool selected;
|
||||
|
||||
@@ -12,4 +12,5 @@ export 'dart:ui' show
|
||||
Point,
|
||||
Rect,
|
||||
Size,
|
||||
TransferMode;
|
||||
TransferMode,
|
||||
VoidCallback;
|
||||
|
||||
@@ -55,8 +55,9 @@ export 'package:flutter/rendering.dart' show
|
||||
TextStyle,
|
||||
TransferMode,
|
||||
ValueChanged,
|
||||
normal,
|
||||
VoidCallback,
|
||||
bold,
|
||||
normal,
|
||||
underline,
|
||||
overline,
|
||||
lineThrough;
|
||||
|
||||
Reference in New Issue
Block a user