We use GestureDetector’s onTap every day, but when does onTapCancel gets called?
I read the implemention code, and noticed that onTapCancel comment:
/// The pointer that previously triggered [onTapDown] will not end up causing
/// a tap.
///
/// This is called after [onTapDown], and instead of [onTapUp] and [onTap], if
/// the tap gesture did not win.
///
/// See also:
///
/// * [kPrimaryButton], the button this callback responds to.
final GestureTapCancelCallback? onTapCancel;
Still can’t figure out a scenary onTapCancel gets called, can anyone give me an example? Thanks in adavance 🙂
>Solution :
It is typically called when the tap that caused onTapDown will not cause onTapUp. For instance, you press down on a GestureDetector, but then move your finger away from it, and let go.