frank
06/03/2023, 2:39 PM@Composable
fun SearchFile(viewModel: SearchFileModel) {
val onclick : (Path) -> () -> Unit = {// Ugly callback - Provisional Solution
{
openFile(it)
focusRequester.requestFocus()
}
}
if (stateUI.isFoundFiles)
filesCard(stateUI.files, onclick) // Composable List
}
@Composable
fun filesCard(files: List<Directory> = listOf(), onclick: (Path) -> () -> Unit ) {
Card (modifier = Modifier.fillMaxHeight(0.9f).fillMaxWidth()) {
LazyColumn(modifier = Modifier.fillMaxHeight()) {
items(files) {file ->
Card(
backgroundColor = Color(245, 238, 254),
shape = RoundedCornerShape(8.dp),
modifier = Modifier.padding(vertical = 4.dp, horizontal = 4.dp),
onClick = onclick(file.path)
) { ...... }
}
}
}
}