Skip to main content
Logo Appt Light

Input cancellation on Flutter

Users should be able to cancel accidental interaction. For example, when users accidentally touches the wrong button, they should be able to undo this and avoid performing an action. Accidental interaction is more common for people with various disabilities.

On Flutter, be careful when using a GestureDetector Avoid using events such as onDown, like onTapDown and onLongPressDown, because users will not be able to cancel their interaction. Use onAction events such onTap or onLongPress instead, because these have built-in support for cancellation.

Widget build(BuildContext context) {
    return new GestureDetector(
        onDown: ... // Use onTap instead


Let us know!