How to show BasicTextField trailing icon right after text in Jetpack compose. My example shows icon at the and of the row, with big space between text and trailingIcon
BasicTextField(
value = selectedText,
onValueChange = { extendedView = false },
readOnly = true,
textStyle = MaterialTheme.typography.bodyMedium,
modifier = Modifier
.fillMaxSize()
.wrapContentHeight()
.menuAnchor()
) {
TextFieldDefaults.TextFieldDecorationBox(
value = selectedText,
innerTextField = it,
singleLine = true,
enabled = false,
visualTransformation = VisualTransformation.None,
trailingIcon = {
Image(
painter = painterResource(id = LocalAppResources.current.arrowDown),
contentDescription = "Arrow down",
contentScale = ContentScale.None,
alignment = Alignment.Center
)
},
placeholder = { account.name },
interactionSource = remember { MutableInteractionSource() },
contentPadding = TextFieldDefaults.textFieldWithoutLabelPadding(
top = 2.dp, bottom = 2.dp, start = 6.dp, end = 0.dp
),
colors = TextFieldDefaults.textFieldColors(
containerColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent
),
)
}
}
