Konstantin Klassen
12/15/2023, 5:53 PMonValueChange
all annotations and styles are stripped 🤷♂️brandonmcansh
12/15/2023, 6:09 PMbrandonmcansh
12/15/2023, 6:10 PMBasicTextField(
modifier = modifier
.defaultMinSize(
minWidth = if (applyMinWidth) FKTextFieldDefaults.MinWidth else 0.dp,
minHeight = if (applyMinHeight) FKTextFieldDefaults.MinHeight else 0.dp,
).onFocusChanged { focused = it.isFocused },
value = value,
onValueChange = onValueChange,
singleLine = singleLine,
maxLines = maxLines,
enabled = enabled,
readOnly = readOnly,
interactionSource = interactionSource,
textStyle = mergedTextStyle,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
onTextLayout = onTextLayout,
cursorBrush = SolidColor(colors.cursorColor(isError).value),
decorationBox = { innerTextField ->
OutlinedTextFieldDefaults.DecorationBox(
value = value.text,
visualTransformation = visualTransformation,
innerTextField = {
Box(contentAlignment = Alignment.CenterStart) {
placeholder()
innerTextField()
}
},
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
prefix = { },
suffix = { },
supportingText = { },
singleLine = singleLine,
enabled = enabled,
isError = isError,
interactionSource = interactionSource,
colors = colors.toTextFieldColors(),
contentPadding = contentPadding,
container = {
val borderStroke by animateBorderStrokeAsState(
enabled = enabled,
interactionSource = interactionSource,
isError = isError,
colors = colors,
focusedBorderThickness = MaterialTheme.dimens.thickBorder,
unfocusedBorderThickness = MaterialTheme.dimens.border,
)
val containerColor by colors.containerColor(
enabled,
isError,
interactionSource
)
Box(
modifier = Modifier
.border(border = borderStroke, shape = shape)
.background(color = containerColor, shape = shape)
.fillMaxSize()
.addIf(onClick != null) {
Modifier.clip(shape)
.clickable { onClick?.invoke() }
},
) {
OutlinedTextFieldDefaults.ContainerBox(
enabled,
isError,
interactionSource,
colors.toTextFieldColors(),
shape
)
}
}
)
}
)
brandonmcansh
12/15/2023, 6:10 PMdecorationBox = { innerTextField ->
OutlinedTextFieldDefaults.DecorationBox(
value = value.text,
visualTransformation = visualTransformation,
innerTextField = {
Box(contentAlignment = Alignment.CenterStart) {
placeholder()
innerTextField()
}
}
is the key partKonstantin Klassen
12/15/2023, 6:55 PMbrandonmcansh
12/15/2023, 6:58 PMKonstantin Klassen
12/15/2023, 7:03 PM/
. That means if the cursor already reached the width of the textfield and I type /
, the hint would appear. But would I scroll to show the hint or let it be clipped? I think it was a bad UX idea from the startKonstantin Klassen
12/15/2023, 7:04 PMTextFieldDefaults.DecorationBox
so that's something, thanks Brandon 😄brandonmcansh
12/15/2023, 7:04 PMbrandonmcansh
12/15/2023, 7:04 PMZach Klippenstein (he/him) [MOD]
12/16/2023, 5:12 PM