uli
12/19/2024, 4:22 PMContactDetailsFlow
consisting of two screens sharing a ViewModel with ContactDetailsFlow
as the store owner.
+- composable<ContactList>
|
+- navigation<ContactDetailsFlow>
|
+- composable<ContactDetailsScreen1>
|
+- composable<ContactDetailsScreen2>
Now the question is,
• where to navigate to? ContactDetailsFlow
or ContactDetailsScreen1
?
• who holds the parameter? ContactDetailsFlow(id)
or `ContactDetailsScreen1(id)`/`ContactDetailsScreen2(id)`or all three?
• If it is ContactDetailsScreen1(id)
what would be the startDestination of ContactDetailsFlow
?
• If it is ContactDetailsFlow(id)
how would deeplinks into the flow work (aka synthetic stack entry for ContactDetailsFlow
)?
• If it is ContactDetailsFlow(id)
how would I navigate (not deeplink) straight to ContactDetailsScreen2
Or maybe the question is simply, can I provide a factory to constuct ContactDetailsFlow
’s route object from deeplinks/child routes during creation of the synthetic back stack. Or is there already any magic?uli
12/20/2024, 7:16 AMStylianos Gakis
12/20/2024, 7:56 AMuli
12/20/2024, 7:58 AMStylianos Gakis
12/20/2024, 8:07 AMuli
12/22/2024, 11:41 PMStylianos Gakis
12/23/2024, 2:32 AMuli
12/23/2024, 3:39 PMnavigation<ContactDescriptionsFlowRoute>(
startDestination = StartDestination,
) {
composable<StartDestination> {
// Unused. Only provided as dummy start destination
}
...
Stylianos Gakis
12/23/2024, 3:47 PMuli
12/23/2024, 3:48 PMStylianos Gakis
12/23/2024, 3:55 PMuli
12/23/2024, 3:58 PMuli
12/23/2024, 4:01 PM@Serializable
private data class ContactDescriptionsFlowRoute(override val contactId: DbId) :
ContactDescriptionsFlowParameters
And it works. not sure if the interface is required, but i think it states nicely, what i am doing.Stylianos Gakis
12/23/2024, 4:05 PMuli
12/23/2024, 4:21 PMContactDetails1Route::class
. Instances of which have a mandatory property contactId
.
• The flow itself has a route of ContactDetailsFlowRoute(contactId)
• I navigate to ContactDetailsFlowRoute(contactId)
.
• Compose Navigation instantiates a route for the startDestination of type ContactDetails1Route (startDestination) with the contact id taken from th contactId property of it’s own route ContactDetailsFlowRoute.
Notes:
I am not sure how the contactId properties of ContactDetailsFlowRoute
and ContactDetails1Route
are linked. By name? By type? By position? (Both routes happen to be data classes and thereby have positional properties)uli
12/23/2024, 4:26 PMStylianos Gakis
12/23/2024, 4:41 PM