Have a beginners question - probably I don’t understand some fundamentals of Composable.
I have a Composable with a BottomSheetScaffold. Within the Sheet I have a Switch which changes a variable that is input to next composable.
fun DuetScreen(
duet: Int,
scaffoldState: BottomSheetScaffoldState,
modifier: Modifier = Modifier
) {
var trp1 by remember { mutableStateOf(true) }
var trp2 by remember { mutableStateOf(true) }
BottomSheetScaffold(
scaffoldState = scaffoldState,
sheetPeekHeight = 0.dp,
sheetContent = {
Box(
Modifier
.fillMaxWidth()
//.background(Color(0xFFF2F2F8))
.height(50.dp),
contentAlignment = Alignment.Center
) {
Text("Settings")
}
Column(
Modifier
.fillMaxWidth()
.padding(20.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text("Trp 1")
Switch(
checked = trp1,
onCheckedChange = {
trp1 = it
}
)
Text("Trp 2")
Switch(
checked = trp2,
onCheckedChange = {
trp2 = it
}
)
}
}) { innerPadding ->
Box(Modifier.padding(innerPadding)) {
DuetScreenWebView(trp1 = trp1, trp2 = trp2, duet = duet)
}
}
}
The idea was that when I change the trp1 value the DuetScreenWebView-composable would also be re-drawn. But that doesn’t happen - what am I doing wrong?