Skip to content

//workflow/com.squareup.workflow1.ui.backstack/BackStackScreen

BackStackScreen

[jvm] @WorkflowUiExperimentalApi()

class BackStackScreen<StackedT : Any>(bottom: StackedT, rest: List<StackedT>)

This will be deprecated in favor of com.squareup.workflow1.ui.container.BackStackScreen very soon.

Represents an active screen (top), and a set of previously visited screens to which we may return (backStack). By rendering the entire history we allow the UI to do things like maintain cached view state, implement drag-back gestures without waiting for the workflow, etc.

Effectively a list that can never be empty.

If multiple BackStackScreens are used as sibling renderings within the same parent navigation container (either the root activity or another BackStackScreen), then the siblings must be distinguished by wrapping them in Named renderings in order to correctly support AndroidX SavedStateRegistry.

Parameters

jvm

bottom

the bottom-most entry in the stack

rest

the rest of the stack, empty by default

Constructors

BackStackScreen [jvm] fun <StackedT : Any> BackStackScreen(bottom: StackedT, vararg rest: StackedT)Creates a screen with elements listed from the bottom to the top.
BackStackScreen [jvm] fun <StackedT : Any> BackStackScreen(bottom: StackedT, rest: List<StackedT>)the bottom-most entry in the stack

Functions

Name Summary
equals [jvm]
Content
open operator override fun equals(other: Any?): Boolean


get [jvm]
Content
operator fun get(index: Int): StackedT


hashCode [jvm]
Content
open override fun hashCode(): Int


map [jvm]
Content
fun <R : Any> map(transform: (StackedT) -> R): BackStackScreen<R>


mapIndexed [jvm]
Content
fun <R : Any> mapIndexed(transform: (index: Int, StackedT) -> R): BackStackScreen<R>


plus [jvm]
Content
operator fun plus(other: BackStackScreen<StackedT>?): BackStackScreen<StackedT>


toString [jvm]
Content
open override fun toString(): String


Properties

Name Summary
backStack [jvm] val backStack: List<StackedT>Screens to which we may return.
frames [jvm] val frames: List<StackedT>
top [jvm] val top: StackedTThe active screen.

Extensions

Name Summary
asNonLegacy [jvm]
Content
@WorkflowUiExperimentalApi()

fun BackStackScreen<*>.asNonLegacy(): BackStackScreen<Screen>