Is something wrong with the SnackBar test code from the official guide? I'm trying to display one in Compose-Desktop and does not work, nothing appears on the screen:
Copy code
@Composable
fun test() {
val scaffoldState = rememberScaffoldState()
val scope = rememberCoroutineScope()
Scaffold(
scaffoldState = scaffoldState,
floatingActionButton = {
var clickCount by remember { mutableStateOf(0) }
ExtendedFloatingActionButton(
text = { Text("Show snackbar") },
onClick = {
// show snackbar as a suspend function
scope.launch {
scaffoldState.snackbarHostState.showSnackbar("Snackbar # ${++clickCount}")
}
}
)
},
content = { innerPadding ->
Text(
text = "Body content",
modifier = Modifier.padding(innerPadding).fillMaxSize().wrapContentSize()
)
}
)
}
Maybe is not compatible with Compose-Desktop?
i
Igor Demin
12/20/2022, 6:09 AM
I tried your example with Compose 1.1.1-1.2.2, and it works. What is your OS?