skip to Main Content

Android Studio – TextField 'OnValueChange' called twice without entering any input

fun TextFieldWithIconsAndErrorLabel( text: String, charLimit: Int = Int.MAX_VALUE, keyboardType: KeyboardType = KeyboardType.Text, onValueChange: (String) -> Unit, ) { val keyboardController = LocalSoftwareKeyboardController.current var shouldShowMaxCharLimitError by remember { mutableStateOf(false) } BasicTextField( modifier = Modifier .fillMaxWidth(), value = text, onValueChange = {…

VIEW QUESTION

Android Studio – how to pass viewModel as parameter in NavHost compose navigation

I have to following NavHost: NavHost( navController = navController, startDestination = Destinations.ComposeEntryPointRoute ) { composable<Destinations.HomeRoute> { HomeContent() } composable<Destinations.GradeConverterRoute> { GradeConverterScreen(navController = navController, gradeConverterViewModel = DONT KNOW WHAT TO DO HERE) } } I don't know how to pass the…

VIEW QUESTION

Android Studio – pass method to Composable as parameter inside clickable lambda. The expression is unused

I have the following Composable @Composable fun ClickableBar(text: String, action: () -> Unit) { Row( modifier = Modifier .height(40.dp) .background(color = AppPrimaryGreen) .fillMaxWidth() .clickable { action }, verticalAlignment = Alignment.CenterVertically ) { Text(text = text) Icon( painter = painterResource(R.drawable.icon_arrow_right), contentDescription…

VIEW QUESTION
Back To Top
Search