StackKt

Added in 1.0.0-alpha02

public final class StackKt


Summary

Public methods

static final void
@Composable
VerticalStack(
    @NonNull Modifier modifier,
    @NonNull StackState state,
    @NonNull Function1<@NonNull StackScopeUnit> content
)

VerticalStack is a lazy scrollable layout that displays its children in a form of a stack where the item on top of the stack is prominently displayed.

Public methods

VerticalStack

@Composable
public static final void VerticalStack(
    @NonNull Modifier modifier,
    @NonNull StackState state,
    @NonNull Function1<@NonNull StackScopeUnit> content
)

VerticalStack is a lazy scrollable layout that displays its children in a form of a stack where the item on top of the stack is prominently displayed. VerticalStack implements the item traversal in a vertical direction.

import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.xr.glimmer.Card import androidx.xr.glimmer.CardDefaults import androidx.xr.glimmer.Text import androidx.xr.glimmer.stack.VerticalStack VerticalStack(modifier = Modifier.height(300.dp)) {  item(key = 0) {  Card(modifier = Modifier.fillMaxSize().itemDecoration(CardDefaults.shape)) {  Text("Item-0")  }  }  items(count = 10, key = { it + 1 }) { index ->  Card(modifier = Modifier.fillMaxSize().itemDecoration(CardDefaults.shape)) {  Text("Item-${index + 1}")  }  } }
Parameters
@NonNull Modifier modifier

the modifier to apply to this layout.

@NonNull StackState state

the state of the stack.

@NonNull Function1<@NonNull StackScopeUnit> content

a block that describes the content. Inside this block you can use methods like StackScope.item to add a single item or StackScope.items to add a collection of items.