InkWell和GestureDetector,如何使它们工作? [英] InkWell and GestureDetector, how to make them work?

查看:78
本文介绍了InkWell和GestureDetector,如何使它们工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用GestureDetector进行onTapDown回调,但是还具有不错的InkWell飞溅效果.

I'd like to use a GestureDetector for it's onTapDown callback but also have a nice InkWell splash effect.

可以同时使用这两个吗?

Is it possible to use these two together?

推荐答案

如果您要无条件处理指针向下事件而没有手势消除歧义,您可以将InkWell设为侦听器的子级,并设置onPointerDown处理程序.

If you want to unconditionally handle the pointer down event with no gesture disambiguation, you can make the InkWell a child of a Listener, and set the onPointerDown handler.

例如:

new Listener(
  onPointerDown: (e) { print('onPointerDown'); },
  child: new InkWell(
    child: new Text('Tap me'),
    onTap: () { print('onTap'); }
  ),
),

向InkWell添加onTapDown处理程序可能很有意义.

It might make sense to add an onTapDown handler to InkWell.

这篇关于InkWell和GestureDetector,如何使它们工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆