val notification = rememberSaveable { mutableStateOf("") } if (notification.value.isNotEmpty()) { Toast.makeText(LocalContext.current, notification.value, Toast.LENGTH_LONG).show() notification.value = "" }
Text(text = "Cancel", modifier = Modifier.clickable { notification.value = "Cancelled" })
@Composable fun SettingsPage(modifier : Modifier = Modifier) { val notification = rememberSaveable { mutableStateOf("") } if (notification.value.isNotEmpty()) { Toast.makeText(LocalContext.current, notification.value, Toast.LENGTH_LONG).show() notification.value = "" } Column (modifier = modifier .background(GreenColorJC) .padding(8.dp) .verticalScroll(rememberScrollState()) .safeDrawingPadding(), ) { Row(modifier = modifier .fillMaxWidth() .padding(8.dp) ) { Text(text = "Cancel", modifier = Modifier.clickable { notification.value = "Cancelled" }) Text(text = "Save", modifier = Modifier.clickable { notification.value = "Saved" }) } } }