Luka

    Luka

    1 year ago
    Hi. Can you help me to remove start padding from buttons text
    @Composable
    fun RepeatButtonsRow( onConfirmClicked: () -> Unit, onRemoveClicked: () -> Unit, onEditClicked: () -> Unit, showEditButton: Boolean ) { Row(horizontalArrangement = Arrangement.Start) { Button( onClick = { onConfirmClicked.invoke() }, elevation = ButtonDefaults.elevation(defaultElevation = 0.dp), colors = ButtonDefaults.textButtonColors(backgroundColor = Color.Transparent) ) { Text( text = stringResource(id = R.string.confirm), textAlign = TextAlign.Left, color = colorResource(id = R.color.red_clickable_link) ) } Button( modifier = Modifier.padding(start = 16.dp), onClick = { onRemoveClicked.invoke() }, elevation = ButtonDefaults.elevation(defaultElevation = 0.dp), colors = ButtonDefaults.textButtonColors(backgroundColor = Color.Transparent) ) { Text( text = stringResource(id = R.string.split_remove), color = colorResource(id = R.color.red_clickable_link) ) } if (showEditButton) { Button( modifier = Modifier.padding(start = 16.dp), onClick = { onEditClicked.invoke() }, elevation = ButtonDefaults.elevation(defaultElevation = 0.dp), colors = ButtonDefaults.textButtonColors(backgroundColor = Color.Transparent) ) { Text( text = stringResource(id = R.string.edit), color = colorResource(id = R.color.red_clickable_link) ) } } } }
    iamthevoid

    iamthevoid

    1 year ago
    contentPadding
    argument in button
    Luka

    Luka

    1 year ago
    What i see is this:
    contentPadding helps but still some space at start:
    t

    Tin Tran

    1 year ago
    You can
    Box
    with
    Modifier.clickable {}
    instead
    Luka

    Luka

    1 year ago
    By having Text wrapped in a Box instead of a Button i think i will lose btn states (pressed, …)?
    t

    Tin Tran

    1 year ago
    I don’t see any state in your code. What do you mean by button states
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    clickable
    takes a
    MutableInteractionSource
    which gives you access to those states.
    Also, source code is easier to read in slack if you use the code block formatting or put it in a snippet.
    Luka

    Luka

    1 year ago
    Thanks @Zach Klippenstein (he/him) [MOD]. Will use block formatting next time. @Tin Tran I meant pressed, focused (selector), like you have in xml based world (different look for different state) 😃