Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Gesture navigation API + swipe implementation #103

Closed

Conversation

KovalevAndrey
Copy link
Collaborator

@KovalevAndrey KovalevAndrey commented Aug 25, 2022

Description

Basic gesture API + Swipe implementation. Implemented as a Modifier which is applied to container composable.

If we agree on the API more gestures to come:

  • draggable
  • multi touching
  • ..

Fixes #97

device-2022-08-25-120746.mp4

Check list

  • I have updated CHANGELOG.md if required.
  • I have updated documentation if required.

@KovalevAndrey KovalevAndrey added the enhancement New feature or request label Aug 25, 2022
@KovalevAndrey KovalevAndrey self-assigned this Aug 25, 2022
@LachlanMcKee
Copy link
Collaborator

Might be worth adding a video (when the PR is ready) to show how it works (with touches displayed)

@CherryPerry
Copy link
Collaborator

Are you sure that is what we need?

I imagined an implementation like in Telegram where a screen follows a finger. It would need to change Children/Child implementations to render not only top active item, but also top non-active.

@KovalevAndrey
Copy link
Collaborator Author

Are you sure that is what we need?

I imagined an implementation like in Telegram where a screen follows a finger. It would need to change Children/Child implementations to render not only top active item, but also top non-active.

We can discuss what we need but I can imaging it's a different API. The problem with this is that inChildren/Child you don't know in which states you children can be and this Telegram style navigation can be applied only for specific nav models like BackStack

@zsoltk
Copy link
Contributor

zsoltk commented Aug 26, 2022

@KovalevAndrey the gestures would be paired to a specific NavModel just like a TransitionHandler is, I don't see an issue with that (e.g. having horizontal swiping in Tiles wouldn't make too much sense). I'm also for the instant response to the gesture.

I think we could:

  1. Use the swipeable api
  2. Anchors would trigger NavModel operations
  3. For an instant animation of a target we would need to apply the same Modifier as we do in the corresponding TransitionHandler.

Possibly we could make all TransitionHandlers expect to work with a Float-based transition spec (as in 0..1f progress), and expose the part which maps FloatModifier. That way we could probably reuse it in the gesture handling.

@KovalevAndrey
Copy link
Collaborator Author

Closing for now as we're trying to implement a different approach for the way we handle transitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gesture navigation
4 participants