Skip to content

【第8章 通过自定义 Recognizer 解决手势冲突】勘误 #233

@chawson

Description

@chawson
class CustomTapGestureRecognizer extends TapGestureRecognizer {
  @override
  void rejectGesture(int pointer) {
    // Pointer事件触发Pan/TouchMove时,Tap事件的状态为possible,此时需rejectGesture
    // 否则拖动后再点按,this.onTap将不会触发,并抛出异常
    if (state == GestureRecognizerState.possible) {
      return super.rejectGesture(pointer);
    }
    super.acceptGesture(pointer);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions