StaticScreen

actual interface StaticScreen : Screen(source)
expect interface StaticScreen : Screen(source)

A marker interface that indicates that this Screen only ever has static content and does not require a presenter to compute or manage its state. This is useful for UIs that either have no state or can derive their state solely from static inputs or the Screen key itself.

Stateless UI

data object ProfileScreen : StaticScreen

@Composable
fun Profile(modifier: Modifier = Modifier) {
Text("Jane", modifier = modifier)
}

val circuit = Circuit.Builder()
.addUi<ProfileScreen> { _, modifier -> Profile(modifier) }
.build()

Static UI

data object ProfileScreen : StaticScreen

@Composable
fun Profile(name: String, modifier: Modifier = Modifier) {
Text(name, modifier = modifier)
}

val circuit = Circuit.Builder()
.addUi<ProfileScreen> { _, modifier ->
// The UI's input is handled in the factory in this case
Profile("Jane", modifier)
}
.build()

Static UI w/ Screen data

data class ProfileScreen(val name: String) : StaticScreen

@Composable
fun Profile(name: String, modifier: Modifier = Modifier) {
Text(name, modifier = modifier)
}

val circuit = Circuit.Builder()
.addUi<ProfileScreen> { screen, modifier ->
Profile(screen.name, modifier)
}
.build()

Static UI w/ Screen input + code gen

data class ProfileScreen(val name: String) : StaticScreen

@CircuitInject(ProfileScreen::class, AppScope::class)
@Composable
fun Profile(screen: ProfileScreen, modifier: Modifier = Modifier) {
Text(screen.name, modifier = modifier)
}
actual interface StaticScreen : Screen(source)
actual interface StaticScreen : Screen(source)
actual interface StaticScreen : Screen(source)
actual interface StaticScreen : Screen(source)

Functions

Link copied to clipboard
abstract fun describeContents(): Int
Link copied to clipboard
abstract fun writeToParcel(p0: Parcel, p1: Int)