Skip to content

Commit f475207

Browse files
committed
Add CreateFolderDialog.kt
1 parent 0477825 commit f475207

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.quickfilemanager.ui.components
2+
3+
import androidx.compose.foundation.layout.*
4+
import androidx.compose.material3.*
5+
import androidx.compose.runtime.*
6+
import androidx.compose.ui.Modifier
7+
import androidx.compose.ui.unit.dp
8+
9+
@Composable
10+
fun CreateFolderDialog(
11+
onDismiss: () -> Unit,
12+
onConfirm: (String) -> Unit
13+
) {
14+
var name by remember { mutableStateOf("") }
15+
16+
AlertDialog(
17+
onDismissRequest = onDismiss,
18+
title = { Text("新建文件夹") },
19+
text = {
20+
OutlinedTextField(
21+
value = name,
22+
onValueChange = { name = it },
23+
label = { Text("文件夹名称") },
24+
singleLine = true,
25+
modifier = Modifier.fillMaxWidth()
26+
)
27+
},
28+
confirmButton = {
29+
TextButton(
30+
onClick = { onConfirm(name) },
31+
enabled = name.isNotBlank()
32+
) {
33+
Text("创建")
34+
}
35+
},
36+
dismissButton = {
37+
TextButton(onClick = onDismiss) {
38+
Text("取消")
39+
}
40+
}
41+
)
42+
}

0 commit comments

Comments
 (0)