-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Make transition customizable depending on screen #18
Comments
This could be tricky with #17, since the direction could change in the middle of a transition. There might be other cases where we'd want to back out of a transition in the middle though too (eg backstack goes from A → B → A before transition finishes), and those cases could all just be handled as the original transition, instead of choosing a new transition in the middle. |
How about I would leave out the concept of "direction" completely. |
Do you need the full lists? Would just a |
For me, it wouldn't be enough. In my app, I use one of 3 different transitions depending on the navigation direction: Forward, backward, sideways. Sideways typically means that the top screen is replaced, so the total screen count remains the same. The idea is to only use the "forward" transition when the user can actually go back to the "from" screen using the back button. Here are 3 scenarios to demonstrate the difference (rightmost screen is topmost): Scenario 1: Scenario 2: Scenario 3: As you can see, I need access to both backstacks to be able to distinguish between these scenarios. |
That makes sense. Could "sideways" also be called "replace"? Another way of solving this would be to make a third |
Possibly, but exactly what that means might not always be so clear. The rules of what counts as backward/forward/replace are quite arbitrary, and I would rather interpret that myself. Another possibility would of course be an overloaded function for more advanced uses. |
Maybe just the one function that takes both lists, and the library provides a helper method to calculate the simple directions given two lists? Although I'm not sure that follows the "make simple things easy, and hard things possible" rule. |
I also thought of a helper as an alternative, but I think I'd prefer the overloaded function though. It follows the common practice in compose where you have one simple and one advanced version of composable funcions. The official API:s are full of them. |
Instead of passing in a single
BackstackTransition
, should take a function of(top: T, below: T, direction) -> BackstackTransition
. Should provide a helper to convert aBackstackTransition
into a function that returns that transition for all values.The function could actually be a single-method interface that BT implements, and until
fun interface
support lands in 1.4 we could provide atransitionFor { top, next, dir -> }
builder function.The text was updated successfully, but these errors were encountered: