
実装
@Composable
private fun MyLoadingView() {
var isLoading by remember { mutableStateOf(false) }
val scope = rememberCoroutineScope()
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally
) {
if (isLoading) {
CircularProgressIndicator()
}
Button(
onClick = {
isLoading = true
scope.launch {
delay(3000) // バックグラウンド処理の模擬動作
isLoading = false
}
}
) {
Text(text = "Tap for Thinking Cloud")
}
}
}
}