Quando coloco dessa forma:
var text = remember {mutableStateOf("")}
OutlinedTextField(value = text.value, onValueChange = {newValue ->
text.value = newValue
})
O código é reconhecido e o aplicativo funciona, mas quando coloco utilizando o "by remember" ele não é reconhecido
var text by remember {mutableStateOf("")}
OutlinedTextField(value = text, onValueChange = {newValue ->
text = newValue
})
@Composable
fun HomeScreen(
sections: Map<String, List<Product>>
) {
Column {
var text by remember { mutableStateOf("") }
OutlinedTextField(value = text, onValueChange = { newValue ->
text = newValue
})
LazyColumn(
Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(vertical = 16.dp)
) {
for (section in sections) {
val title = section.key
val products = section.value
item {
ProductSection(
title = title,
productList = products
)
}
}
}
}
}