Skip to content

Comments

Add options to activate Hero for different gesture behaviours.#1

Open
MCYBA wants to merge 1 commit intoSametSahin10:masterfrom
MCYBA:master
Open

Add options to activate Hero for different gesture behaviours.#1
MCYBA wants to merge 1 commit intoSametSahin10:masterfrom
MCYBA:master

Conversation

@MCYBA
Copy link

@MCYBA MCYBA commented Aug 25, 2022

  • Add
enum GestureName {
 onTap,
 onDoubleTap,
 onLongPress,
 onScaleStart,
 onScaleEnd,
}

to define gesture callbacks.

  • Assign final List<GestureName> gestureNames; parameter to keep activated ones.

  • Wrap the FullScreenPage route with function named forwardFullScreen.

  • Finally check the gestureNames and call forwardFullScreen like:

GestureDetector(
      onTap: (gestureNames.isEmpty || gestureNames.contains(GestureName.onTap))
          ? () {
              forwardFullScreen(context);
            }
          : null,
      onDoubleTap: (gestureNames.contains(GestureName.onDoubleTap))
          ? () {
              forwardFullScreen(context);
            }
          : null,
// ...
      child: child,
    );
  • Make sure at least call forwardFullScreen during onTap gesture if gestureNames is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant