-
public final class NavHostKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> UnitNavHost(NavController<T> controller, Modifier modifier, Function0<Unit> emptyBackstackPlaceholder, Alignment contentAlignment, Function2<NavHostScope<T>, T, Unit> contentSelector)A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the controller's backstack. final static <T extends Any> UnitNavHost(NavBackstack<T> backstack, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<NavHostScope<T>, T, Unit> contentSelector)A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack. final static <T extends Any> UnitNavHost(NavHostState<T> state, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<NavHostScope<T>, T, Unit> contentSelector)A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack. final static <T extends Any, S extends Any> UnitScopingNavHost(NavController<T> controller, NavScopeSpec<T, S> scopeSpec, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<ScopingNavHostScope<T, S>, T, Unit> contentSelector)A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the controller's backstack. final static <T extends Any, S extends Any> UnitScopingNavHost(NavBackstack<T> backstack, NavScopeSpec<T, S> scopeSpec, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<ScopingNavHostScope<T, S>, T, Unit> contentSelector)A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack. final static <T extends Any, S extends Any> UnitScopingNavHost(ScopingNavHostState<T, S> state, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<ScopingNavHostScope<T, S>, T, Unit> contentSelector)A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack. -
-
Method Detail
-
NavHost
@Composable() final static <T extends Any> Unit NavHost(NavController<T> controller, Modifier modifier, Function0<Unit> emptyBackstackPlaceholder, Alignment contentAlignment, Function2<NavHostScope<T>, T, Unit> contentSelector)
A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the controller's backstack.
This composable doesn't provide animated transitions between destinations - it will simply jump-cut to the next destination.
If you need animated transitions use AnimatedNavHost instead. For smoother transitions between dialogs use DialogNavHost.
- Parameters:
controller- the navigation controller that will provide its backstack to this NavHost.modifier- the modifier to be applied to NavHostemptyBackstackPlaceholder- an optional placeholder composable that will be displayed when the backstack is empty.contentAlignment- the alignment inside NavHostcontentSelector- provides a composable that corresponds to the current last destination in the backstack.
-
NavHost
@Composable() final static <T extends Any> Unit NavHost(NavBackstack<T> backstack, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<NavHostScope<T>, T, Unit> contentSelector)
A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack.
This composable doesn't provide animated transitions between destinations - it will simply jump-cut to the next destination.
If you need animated transitions use AnimatedNavHost instead. For smoother transitions between dialogs use DialogNavHost.
- Parameters:
backstack- the backstack from a NavController that will be used to observe navigation changes.modifier- the modifier to be applied to NavHostcontentAlignment- the alignment inside NavHostemptyBackstackPlaceholder- an optional placeholder composable that will be displayed when the backstack is empty.contentSelector- provides a composable that corresponds to the current last destination in the backstack.
-
NavHost
@Composable() final static <T extends Any> Unit NavHost(NavHostState<T> state, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<NavHostScope<T>, T, Unit> contentSelector)
A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack.
This composable doesn't provide animated transitions between destinations - it will simply jump-cut to the next destination.
If you need animated transitions use AnimatedNavHost instead. For smoother transitions between dialogs use DialogNavHost.
- Parameters:
state- the holder of all internal NavHost state.modifier- the modifier to be applied to NavHostcontentAlignment- the alignment inside NavHostemptyBackstackPlaceholder- an optional placeholder composable that will be displayed when the backstack is empty.contentSelector- provides a composable that corresponds to the current last destination in the backstack.
-
ScopingNavHost
@Composable() final static <T extends Any, S extends Any> Unit ScopingNavHost(NavController<T> controller, NavScopeSpec<T, S> scopeSpec, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<ScopingNavHostScope<T, S>, T, Unit> contentSelector)
A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the controller's backstack.
This composable doesn't provide animated transitions between destinations - it will simply jump-cut to the next destination.
If you need animated transitions use AnimatedNavHost instead. For smoother transitions between dialogs use DialogNavHost.
Scoping: This version of NavHost gives you the ability to define scopes. Read more about it in NavScopeSpec.
- Parameters:
controller- the navigation controller that will provide its backstack to this NavHost.scopeSpec- specifies scopes for every destination.modifier- the modifier to be applied to NavHostcontentAlignment- the alignment inside NavHostemptyBackstackPlaceholder- an optional placeholder composable that will be displayed when the backstack is empty.contentSelector- provides a composable that corresponds to the current last destination in the backstack.
-
ScopingNavHost
@Composable() final static <T extends Any, S extends Any> Unit ScopingNavHost(NavBackstack<T> backstack, NavScopeSpec<T, S> scopeSpec, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<ScopingNavHostScope<T, S>, T, Unit> contentSelector)
A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack.
This composable doesn't provide animated transitions between destinations - it will simply jump-cut to the next destination.
If you need animated transitions use AnimatedNavHost instead. For smoother transitions between dialogs use DialogNavHost.
Scoping: This version of NavHost gives you the ability to define scopes. Read more about it in NavScopeSpec.
- Parameters:
backstack- the backstack from a NavController that will be used to observe navigation changes.scopeSpec- specifies scopes for every destination.modifier- the modifier to be applied to NavHostcontentAlignment- the alignment inside NavHostemptyBackstackPlaceholder- an optional placeholder composable that will be displayed when the backstack is empty.contentSelector- provides a composable that corresponds to the current last destination in the backstack.
-
ScopingNavHost
@Composable() final static <T extends Any, S extends Any> Unit ScopingNavHost(ScopingNavHostState<T, S> state, Modifier modifier, Alignment contentAlignment, Function0<Unit> emptyBackstackPlaceholder, Function2<ScopingNavHostScope<T, S>, T, Unit> contentSelector)
A basic navigation host that selects UI for every destination and provides saved state and Android architecture components (Lifecycle, ViewModelStore, SavedStateRegistry) through CompositionLocalProvider for every unique NavEntry in the backstack.
This composable doesn't provide animated transitions between destinations - it will simply jump-cut to the next destination.
If you need animated transitions use AnimatedNavHost instead. For smoother transitions between dialogs use DialogNavHost.
Scoping: This version of NavHost gives you the ability to define scopes. Read more about it in NavScopeSpec.
- Parameters:
state- the holder of all internal ScopingNavHost state.modifier- the modifier to be applied to NavHostcontentAlignment- the alignment inside NavHostemptyBackstackPlaceholder- an optional placeholder composable that will be displayed when the backstack is empty.contentSelector- provides a composable that corresponds to the current last destination in the backstack.
-
-
-
-