Archie
11/05/2021, 3:58 PMArchie
11/05/2021, 4:02 PMArchie
11/05/2021, 4:02 PMArchie
11/05/2021, 4:03 PMcommon
module which would be a dependency of the each of the 3 app module.Archie
11/05/2021, 4:03 PMcommon
module we define the Screen:
GenericScreen(
...
title: @Composable () -> Unit, // a composable function to make it flexible
...
)
Archie
11/05/2021, 4:03 PMcommon
module we also want to define our NavGraph
as all the app should also have the same navigation.
fun GenericNavGraph(
...
title: @Composable () -> Unit,
) {
NavGraph(
...
) {
composable("route") {
GenericScreen(
...
title = title
...
)
}
}
}
Archie
11/05/2021, 4:03 PMfun GenericNavGraph(
...
title: @Composable () -> Unit,
anotherBranding: @Composable () -> Unit,
anotherOne: @Composable () -> Unit,
nextOne: @Composable () -> Unit,
...
) {
NavGraph(
...
) {
composable("route") {
GenericScreen(
...
title = title
...
)
}
}
....
}
Archie
11/05/2021, 4:03 PMabstract class Branding {
@Composable
abstract fun Title()
....
}
to manage the NavGraph
fun GenericNavGraph(
...
branding: Branding = rememberBranding()
...
) {
composable("route") {
GenericScreen(
...
title = branding.Title,
...
)
}
...
}
Is this a good idea?Archie
11/05/2021, 4:12 PMjim
11/05/2021, 4:34 PMArchie
11/05/2021, 4:39 PM