Scaffold implements the basic Wear Material Design visual layout structure.
@SuppressLint("UnrememberedMutableState")
@Composable
fun SimpleScaffoldWithScrollIndicator() {
val listState = rememberScalingLazyListState()
val vignetteState = mutableStateOf(VignettePosition.TopAndBottom)
val showVignette = mutableStateOf(true)
Scaffold(
positionIndicator = {
PositionIndicator(scalingLazyListState = listState, modifier = Modifier)
},
vignette = {
if (showVignette.value) {
Vignette(vignettePosition = vignetteState.value)
}
},
timeText = { TimeText() },
) {
ScalingLazyColumn(
contentPadding = PaddingValues(top = 40.dp),
state = listState,
modifier = Modifier.fillMaxWidth(),
) {
item {
Chip(
onClick = { showVignette.value = false },
label = { Text("No Vignette") },
colors = ChipDefaults.secondaryChipColors(),
)
}
item {
Chip(
onClick = {
showVignette.value = true
vignetteState.value = VignettePosition.Top
},
label = { Text("Top Vignette only") },
colors = ChipDefaults.secondaryChipColors(),
)
}
item {
Chip(
onClick = {
showVignette.value = true
vignetteState.value = VignettePosition.Bottom
},
label = { Text("Bottom Vignette only") },
colors = ChipDefaults.secondaryChipColors(),
)
}
item {
Chip(
onClick = {
showVignette.value = true
vignetteState.value = VignettePosition.TopAndBottom
},
label = { Text("Top and Bottom Vignette") },
colors = ChipDefaults.secondaryChipColors(),
)
}
items(20) {
Chip(
onClick = {},
label = { Text("List item $it") },
colors = ChipDefaults.secondaryChipColors(),
)
}
}
}
}