https://kotlinlang.org logo
#compose
Title
# compose
m

mario

07/21/2021, 11:29 AM
Hello, I have a question about alerdialog, this component only can have a title and a text? according the API one alertdialog have these parameters
Copy code
title: (@Composable () -> Unit)? = null,
text: @Composable (() -> Unit)? = null,
 both are composable but the name indicate something specific (text). I have tried to create a OutlinedTextField in text parameter with a strange result, it would not be better to create a content parameter?
and no, the
text
composable slot allows you to set anything inside it
m

mario

07/21/2021, 11:33 AM
yes I know is a compose function, but I have a strange result with a OutlinedTextField, and the name "text" maybe would be better a "content" as a button
a

alorma

07/21/2021, 11:34 AM
what youmean by "strange result".... if you post some code, and screenshots we may can help you
m

mario

07/21/2021, 11:34 AM
yes let me share a video
a

alorma

07/21/2021, 11:35 AM
🙌 1
👀 1
m

mario

07/21/2021, 11:43 AM
Copy code
@Composable
fun AddAlertDialog() {
    val textState = remember { mutableStateOf(TextFieldValue()) }
    AlertDialog(
        onDismissRequest = { },
        text = {
            OutlinedTextField(
                modifier = Modifier.wrapContentWidth(),
                value = textState.value,
                onValueChange = { textState.value = it },
                label = { Text("Nueva categoría") })
        },
        dismissButton = {
            TextButton(
                onClick = {}) {
                Text(stringResource(id = android.R.string.cancel).uppercase(Locale.getDefault()))
            }
        },
        confirmButton = {
            TextButton(
                onClick = {}) {
                Text(stringResource(id = android.R.string.ok))

            }
        }
    )
}
I am using rc2
a

alorma

07/21/2021, 11:52 AM
uhmmm, yes weird. maybe use a Box, and give it a fixed height bigger than the outlined text box itself
m

mario

07/21/2021, 12:00 PM
yes, this way works but i wouldn't like to have a fixed height, wrapContentHeight should work 😞
a

alorma

07/21/2021, 12:02 PM
don't forget to mention if you found a solutioon
m

mario

07/21/2021, 12:03 PM
ok I will do so, thx
@alorma I found the problem
a

alorma

07/21/2021, 12:14 PM
🦜
m

mario

07/21/2021, 12:14 PM
the problem is my custom typografy
I am using font
Copy code
Sarabum
it must be a little bigger than the default
im going to open a issue because i think should adapt to all kinds of fonts
e

Eric Ampire [MOD]

07/23/2021, 9:01 AM
It's also possible to use
Dialog
instead of
AlertDialog
if you want to have a custom layout
2 Views