Package-level declarations

Types

Link copied to clipboard

Circuit adapts presenter factories to their corresponding ui factories using screens. Create instances using the Builder and create new CircuitContent with it to run presenter/UI pairings.

Link copied to clipboard
interface EventListener

A listener for tracking the state changes of a given Screen. This can be used for instrumentation and other telemetry.

Link copied to clipboard
sealed interface NavEvent : CircuitUiEvent

A sealed navigation interface intended to be used when making a navigation callback.

Link copied to clipboard

Default values and common alternatives used by navigable composables.

Link copied to clipboard
class RecordContentProvider<R : BackStack.Record>(val record: R, content: @Composable (R) -> Unit)

A simple holder class for a record and its associated content.

Properties

Link copied to clipboard

The Circuit used in this context.

Link copied to clipboard

CompositionLocal with a current Circuit instance.

Functions

Link copied to clipboard

Returns whether or not answering navigation is available. This is essentially a proxy for whether or not this composition is running within a NavigableCircuitContent.

Link copied to clipboard
fun CircuitCompositionLocals(circuit: Circuit, retainedStateRegistry: RetainedStateRegistry = continuityRetainedStateRegistry(), content: @Composable () -> Unit)

Provides the given circuit as a CompositionLocal to all composables within content. Also adds any other composition locals that Circuit needs.

Link copied to clipboard
fun CircuitContent(screen: Screen, modifier: Modifier = Modifier, circuit: Circuit = requireNotNull(LocalCircuit.current), unavailableContent: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent, key: Any? = screen)
fun <UiState : CircuitUiState> CircuitContent(screen: Screen, modifier: Modifier, presenter: Presenter<UiState>, ui: Ui<UiState>, eventListener: EventListener = EventListener.NONE, key: Any? = screen)
fun CircuitContent(screen: Screen, modifier: Modifier = Modifier, onNavEvent: (event: NavEvent) -> Unit, circuit: Circuit = requireNotNull(LocalCircuit.current), unavailableContent: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent, key: Any? = screen)
fun CircuitContent(screen: Screen, navigator: Navigator, modifier: Modifier = Modifier, circuit: Circuit = requireNotNull(LocalCircuit.current), unavailableContent: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent, key: Any? = screen)
Link copied to clipboard
fun <R : BackStack.Record> NavigableCircuitContent(navigator: Navigator, backStack: BackStack<R>, modifier: Modifier = Modifier, circuit: Circuit = requireNotNull(LocalCircuit.current), providedValues: ImmutableMap<out BackStack.Record, ProvidedValues> = providedValuesForBackStack(backStack), decoration: NavDecoration = circuit.defaultNavDecoration, unavailableRoute: @Composable (screen: Screen, modifier: Modifier) -> Unit = circuit.onUnavailableContent)
Link copied to clipboard
fun Navigator(backStack: BackStack<out BackStack.Record>, onRootPop: (result: PopResult?) -> Unit): Navigator

Creates a new Navigator.

Link copied to clipboard

A Circuit call back to help navigate to different screens. Intended to be used when forwarding NavEvents from nested Presenters.

Link copied to clipboard
inline fun <T : PopResult> rememberAnsweringNavigator(backStack: BackStack<out BackStack.Record>, noinline block: suspend CoroutineScope.(result: T) -> Unit): GoToNavigator
inline fun <T : PopResult> rememberAnsweringNavigator(fallbackNavigator: Navigator, noinline block: suspend CoroutineScope.(result: T) -> Unit): GoToNavigator

A reified version of rememberAnsweringNavigator. See documented overloads of this function for more information.

fun <T : PopResult> rememberAnsweringNavigator(backStack: BackStack<out BackStack.Record>, resultType: KClass<T>, block: suspend CoroutineScope.(result: T) -> Unit): GoToNavigator

Returns a GoToNavigator that answers with the given resultType using the given backStack.

fun <T : PopResult> rememberAnsweringNavigator(fallbackNavigator: Navigator, resultType: KClass<T>, block: suspend CoroutineScope.(result: T) -> Unit): GoToNavigator

Returns a GoToNavigator that answers with the given resultType or defaults to fallbackNavigator if no back stack is available to pass results through.

Link copied to clipboard
fun rememberCircuitNavigator(backStack: BackStack<out BackStack.Record>, enableBackHandler: Boolean = true): Navigator

Returns a new Navigator for navigating within CircuitContents. Delegates onRootPop to the LocalOnBackPressedDispatcherOwner.

fun rememberCircuitNavigator(backStack: BackStack<out BackStack.Record>, onRootPop: (result: PopResult?) -> Unit): Navigator

Creates and remembers a new Navigator for navigating within CircuitContents.

Link copied to clipboard
inline fun rememberEventListener(screen: Screen, context: CircuitContext = CircuitContext.EMPTY, startOnInit: Boolean = true, factory: EventListener.Factory? = null): EventListener

Remembers a new EventListener instance for the given screen and context.

Link copied to clipboard
inline fun rememberPresenter(screen: Screen, navigator: Navigator = Navigator.NoOp, context: CircuitContext = CircuitContext.EMPTY, eventListener: EventListener = EventListener.NONE, factory: Presenter.Factory): Presenter<CircuitUiState>?

Remembers a new Presenter instance for the given screen, navigator, context, and eventListener.

Link copied to clipboard
inline fun rememberUi(screen: Screen, context: CircuitContext = CircuitContext.EMPTY, eventListener: EventListener = EventListener.NONE, factory: Ui.Factory): Ui<CircuitUiState>?

Remembers a new Ui instance for the given screen, context, and eventListener.