I'm trying to achieve this design with compose. I ...
# compose
r
I'm trying to achieve this design with compose. I want to open dialpad with number input keyboard, this action triggers once I click FAB icon. I do not have TextField so cannot call the keyboard by default, in my case keyboard should open clicking on FAB. I have tried few things, but keyboard won't show up, any clue?
Copy code
Scaffold(
    floatingActionButton = {
        FloatingDialButton(
            keyboardController,
            focusRequester
        )
    },
    modifier = Modifier.focusRequester(focusRequester)
) {
    ScreenContent(uiState)
}
@Composable
fun FloatingDialButton(
    keyboardController: SoftwareKeyboardController?,
    focusRequester: FocusRequester,
) {
    FloatingActionButton(
        onClick = {
            focusRequester.requestFocus()
            keyboardController?.show()
        },
    ) {
        Icon(
            painterResource(id = R.drawable.ic_dialpad),
            contentDescription = "",
            tint = MaterialTheme.colors.onSecondary
        )
    }
}
d
looks like this is TextField, so you have to set Modifier.focusRequester(forusRequester) to it
👍 1