File tree Expand file tree Collapse file tree
app/src/main/java/com/quickfilemanager/ui/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 RenameDialog (
11+ currentName : String ,
12+ onDismiss : () -> Unit ,
13+ onConfirm : (String ) -> Unit
14+ ) {
15+ var name by remember { mutableStateOf(currentName) }
16+
17+ AlertDialog (
18+ onDismissRequest = onDismiss,
19+ title = { Text (" 重命名" ) },
20+ text = {
21+ OutlinedTextField (
22+ value = name,
23+ onValueChange = { name = it },
24+ label = { Text (" 文件名" ) },
25+ singleLine = true ,
26+ modifier = Modifier .fillMaxWidth()
27+ )
28+ },
29+ confirmButton = {
30+ TextButton (
31+ onClick = { onConfirm(name) },
32+ enabled = name.isNotBlank() && name != currentName
33+ ) {
34+ Text (" 确定" )
35+ }
36+ },
37+ dismissButton = {
38+ TextButton (onClick = onDismiss) {
39+ Text (" 取消" )
40+ }
41+ }
42+ )
43+ }
You can’t perform that action at this time.
0 commit comments