val pullRefreshState = rememberPullRefreshState(isRefreshing, { /* TODO */ })
Box(
modifier = Modifier
.fillMaxSize()
.pullRefresh(pullRefreshState)
) {
LazyColumn {
items(100) { index ->
Text("Item $index", modifier = Modifier.padding(16.dp))
}
}
}
var showPopup by remember { mutableStateOf(false) }
Box {
Button(onClick = { showPopup = true }) {
Text("Show Popup")
}
if (showPopup) {
Popup(alignment = Alignment.Center) {
Box(
modifier = Modifier
.size(200.dp)
.background(Color.White)
.clickable { showPopup = false }
) {
Text("This is a popup")
}
}
}
}
@Composable
fun DebugComposable() {
val count = remember { mutableStateOf(0) }
Log.d("DebugComposable", "Recomposition count: ${count.value}")
Button(onClick = { count.value++ }) {
Text("Click me")
}
}
val state = remember { mutableStateOf(0) }
TopAppBar(
title = { Text("Nim App") },
navigationIcon = {
IconButton(onClick = { /* Navigate back */ }) {
Icon(Icons.Filled.ArrowBack, contentDescription = "Back")
}
},
actions = {
IconButton(onClick = { /* Perform action */ }) {
Icon(Icons.Filled.Settings, contentDescription = "Settings")
}
}
)
Scaffold(
topBar = {
TopAppBar(title = { Text("Home") })
},
content = { padding ->
Box(modifier = Modifier.padding(padding)) {
Text("Content goes here")
}
}
)
var showDialog by remember { mutableStateOf(false) }
if (showDialog) {
AlertDialog(
onDismissRequest = { showDialog = false },
title = { Text("Alert") },
text = { Text("This is an alert dialog") },
confirmButton = {
Button(onClick = { showDialog = false }) {
Text("OK")
}
},
dismissButton = {
Button(onClick = { showDialog = false }) {
Text("Cancel")
}
}
)
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。