Hi. Can you help me to remove start padding from b...
# compose
l
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) ) } } } }
i
contentPadding
argument in button
1
l
What i see is this:
contentPadding helps but still some space at start:
t
You can
Box
with
Modifier.clickable {}
instead
l
By having Text wrapped in a Box instead of a Button i think i will lose btn states (pressed, …)?
t
I don’t see any state in your code. What do you mean by button states
z
clickable
takes a
MutableInteractionSource
which gives you access to those states.
👍 2
Also, source code is easier to read in slack if you use the code block formatting or put it in a snippet.
l
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) :)